Category : Music Project

MySql doesn’t accept polish letters [Music no 12]

I had a problem to make insert to database like that:

I got an error:

#1366 – Incorrect string value: ‚\xC4\x99d\xC4\x99 …’ for column ‚Name’ at row 1

After small investigation I found out that each column in mysql has itself encoding. To allow polish encoding in column name I had to set encoding to ‚utf8’ or ‚utf8_polish_ci’.

How to allow remote connection to mysql [Music no 11]

In the previous blog post, I show how to create MySQL database on linux server. I was able to access that MySQL, create db, create users and so on. The music application which is no the server is able to use this db. BUT! Nobody can access that database from outside. I am not able to connect from my localhost to my database on Linux server. How I can handle that?

So my application on server has a pretty straightforad connection string:

But the very same connection won’t work on my localhost. So what I have to do? First I go /etc/mysql/mysql.conf.d/mysqld.cnf and edit line with:

read more

How to disable SSH login for the root user on Linux? [Music no 10]

I had a problem that sometimes somebody hacked my password to my Linux server and run some programs on my Linux server. Every time when I decided to rebuild my Linux distribution on the server and change password to more crazy after a few months this happened
again – somebody hacked access to my Linux.

I digged a little bit and quickly I found the solution. I just turn off an option to be able to login as root user
Go to file: /etc/ssh/sshd_config
Find a line with text: #PermitRootLogin yes
Change it to: PermitRootLogin no
Confirm with: sudo service ssh restart

Confirm with
Save and done.

https://mediatemple.net/community/products/dv/204643810/how-do-i-disable-ssh-login-for-the-root-user

Set up .NET Core project in Linux with Nginx [Music no 9]

This post is continuation of previous one.

I created new folder where I’ll have production code:

Then I clone repo to that place

I use User Secrets approach. So I need to create specific folder and copy there my secrect.josn

To run my application I go to specific folder and just run it :).

I added file /etc/nginx/site-available/<live>.<mywebsite.com>

read more

How To Install Nginx, MySQL, PHP, PhpMyAdmin, .NET Core in Ubuntu 18.04 [Music no 8]

I wrote this post because I tried to have on one Linux server .NET Core app and MySQL with PhpMyAdmin tool. On the Internet I found how to do it on 16.04, but it doesn’t work as ease as it is written on 18.04.

I wrote that post base on articles: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04 and https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-with-nginx-on-ubuntu-16-04.

Login to linux as root. First add a new user with sudo permissions:

You may log to the new one which you’ve just created and get all available updates to your Linux:

Then install server www and proxy server:

read more

OVH domain and Linode Domain [Music no 7]

I moved from www.oktawave.com to https://www.linode.com/.Linode is cheaper and has more RAM and disk space. I followed that instruction https://www.linode.com/docs/getting-started/ to set up a new machine. It is worth to remember to google some promo code to get an extra start some extra dollars for new register users.

I decided to follow instructions from my post Hosting two websites on one linux server [Music no 5].

Moreover, I bought a new domain on ovh.

  1. First I had to set DNS servers. I went to https://manager.linode.com/dns. Hit DNS Manager -> Add a domain zone read more

One code, two apps, different connection strings. How to managed that problem on asp.net core 2 [Music no 6]

I want to host two applications on one Linux server. One app for dev, another app for users. The problem which I have is that I try managed with sensitive data like connection string. Both databases (for dev and prod) are available on the Internet. Ideally, I want to write an app on the Windows, then push changes to GitHub, next go to console in Linux, get latest changes and build the app with proper commend either as the prod or as the dev build.

I don’t want to hardcode sensitive values in code or put them to a json file because by mistake I could commit that to GitHub. In that case, I decided to use SecretManager Tool in asp.net core 2. How is it work is nicely explained: https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-2.1&tabs=visual-studio and https://dotnetcore.gaprogman.com/2017/09/07/user-secrets-what-are-they-and-why-do-i-need-them/

My secret.json looks like that:

So with one code, I want to be able to choose which connection string I want to use without changing environment variables on Linux. In that case, I decided to run the app with some commands. The idea comes from https://stackoverflow.com/questions/40748518/how-to-configure-mutilple-aspnetcore-environment-on-same-machine/40750166

To select proper connection string I use that code:

And it’s work!

Code: https://github.com/Jaryn91/Music/commit/1f94a8d609785a50c56e5aaae3533a979674d5b2

 

Other links:

https://www.lifewire.com/create-directories-linux-mkdir-command-3991847

https://winscp.net/eng/docs/ui_pref_panels

Hosting two websites on one linux server [Music no 5]

I’ve already lost loads of time with my project. People could use my app for 2 weeks at least. But I try to improve that to make it better and more generic. All the time I check if everything is up and running on to Linux server. I came up with the idea to host two apps on one Linux server. The first one app will be a training ground, the second app will be production app. I looked for some solution how to host two apps on one server. At the begging, I struggled a little bit how to google that. but finally, I came up with the proper google phrase :).

https://askubuntu.com/questions/766352/multiple-websites-on-nginx-one-ip

I’ll try to follow steps from that link and I’ll see if it will work for me. I’ll go for the second option:
The one-domain, multiple subdomains approach.

But first I’ll create a subdomain ;). I’ll have to wait for 24 h for the propagation of new domain :).

Meantime I found 5 dollars/month vm comparison: https://joshtronic.com/2017/02/14/five-dollar-showdown-linode-vs-digitalocean-vs-lightsaild-vs-vultr/

How to debug .net core 2 app on linux server via visual studio 2017 on windows? [Music no 4]

Follow those steps if the app is up and running 🙂

  1. Go to putty:
  2. Debug -> Attach to process
  3. Select Connection type: SSH and write Connection target: root@yourservername.com
    read more

How to set up Linux server for asp.net core 2 web app and make it visible on internet? Part 3 [Music no 3]

How to  publish site with Visual Studio 2017 to Linux server:

 

 

  1. Go to VS2017 and hit publish on project:
  2.  Set up debug mode on publish:
  3. read more

Powered by: Wordpress