Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Complete walkthrough of setup on Centos 7

Steven Hildreth edited this page Dec 8, 2019 · 28 revisions

Steps I took to setup the demo site using Centos 7 (64 bit). This was setup using a cheap VPS with these specifications:

  • 4 CPU Cores
  • 4096MB (4GB) RAM
  • 30GB SSD Storage
  • 1Gbps Network

Here are the steps:

  • Update packages
    • # yum upgrade
  • Create a non-root user with wheel access
    • # adduser username
    • # passwd username
    • # usermod -aG wheel username
    • Now log in as this new user
  • Install Screen, Nano and Midnight Commander
    • sudo yum install -y screen nano mc
  • Install Nginx
    • sudo yum install epel-release
    • sudo yum install nginx
    • sudo systemctl start nginx
    • sudo systemctl enable nginx
    • If you are using firewall-cmd:
      • sudo firewall-cmd --permanent --zone=public --add-service=http
      • sudo firewall-cmd --permanent --zone=public --add-service=https
      • sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
      • sudo firewall-cmd --reload
    • Modify the nginx.conf file to have the port forwarding to proxy to Roadie.Api running (default is at port 5555)
        server { 
          listen 8080 ssl http2; # certificate configurations here 
          location / { 
              proxy_pass http://localhost:5555;
          }
       }
      
    • If you are using roadie-vuejs modify the nginx.conf file to have the error_page setup to return to index
      server { 
             error_page 404 /index.html; 
             index index.html; 
             root /path/to/roadie-vuejs; 
             server_name your_host.your_domain; 
         }
      
    • setsebool -P httpd_can_network_connect 1
  • Setup Lets Encrypt
    • This is a good reference article from DigitalOcean.
    • This requires your domain to have a DNS record. Ensure that your IP for your server resolves to a DNS address by creating at least the 'www.your_server.your_domain' DNS A record.
    • sudo yum install certbot-nginx
    • Modify your Nginx configuration and setup your server name.
    • sudo systemctl reload nginx
    • sudo certbot --nginx -d your_hostname.your_domain -d www.your_hostname.your_domain
  • Install MariaDB
    • sudo nano /etc/yum.repos.d/MariaDB.repo
    •    name = MariaDB 
         baseurl = http://yum.mariadb.org/10.3/centos7-amd64 
         gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
         gpgcheck=1```
      
    • sudo yum install MariaDB-server MariaDB-client -y
    • sudo firewall-cmd --reload
    • sudo systemctl start mariadb
    • sudo systemctl enable mariadb
    • sudo mysql_secure_installation (remember the root password you provide here)
  • Create the database and the database user
    • mysql -u root -p
    • create database roadie CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    • grant all privileges on roadie.* to roadie@'localhost' identified by 'some_password_you_like';
    • flush privileges;
    • \q
    • mysql -u root -p roadie < roadie.sql (found here)
  • Install dotnet core
    • sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
    • sudo yum update
    • sudo yum install dotnet-sdk-<version>
    • dotnet --version
  • Modify the appsettings.json file in the Roadie.Api folder ensure the connection string has the server, user and password setup above for MariaDB.
  • Ensure you have your CORSOrigin setup proper for the demo server (running at www.roadie.rocks) the configuration is:
    • "CORSOrigins": "https://www.roadie.rocks|https://www.roadie.rocks:8080"

At this point you can either start a screen session and run dotnet Roadie.Api.Dll or Setup a service:

  • Edit /etc/systemd/system/roadie.service:
      [Unit]  
      Description=Roadie service  
    
      [Service]  
      ExecStart=/usr/bin/dotnet Roadie.Api.dll  
      WorkingDirectory=/<directory_to_your_Roadie_dll/  
      User=<user_to_run_as>  
      Group=<group_to_run_as>  
      Restart=on-failure  
      SyslogIdentifier=roadie-service  
      PrivateTmp=true  
    
      [Install]  
      WantedBy=multi-user.target
    
  • Reload systemd sudo systemctl daemon-reload
  • Start service sudo systemctl start roadie
  • Enable service to restart at boot sudo systemctl enable roadie
  • Check status of service sudo systemctl status roadie
Clone this wiki locally