Skip to content

GeoSenEsm/devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

DevOps repository for the GeoSenEsm system

This repository contains detailed instructions on how to set up the production environment for:

  • REST API
  • Admin panel

on Ubuntu.

Initial conditions

To set up the environment in the most basic scenario, you need at least one server (Ubuntu). It needs to meet these conditions:

  • Docker installed and running (installation guide)
  • Nginx installed (installation guide)
  • You need to purchase a domain for your server. Ultimately, you need two subdomains for admin panel and API. In this document we'll assume your domains are admin.mydomain.com and api.mydomain.com.

Setting up the domain and Nginx

  1. Configure your domain to point to your server IP via DNS.
  2. Install and start Nginx:
sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
  1. Add privacy policy to your server

    You are responsible for managing your respondents' data, therefore you must provide a privacy policy. Respondents will have to accept it after their first login to the mobile app. Add the privacy policy as HTML documents in /var/www/html/privacy-policy. Currently three languages are supported: English (en.html), Chinese (cn.html), and Polish (pl.html). If you do not provide a language-specific policy, the English version (en.html) will be used as the default. In the future, additional languages may be supported as the mobile app evolves.

  2. Configure Nginx to proxy requests

    Copy the configuration below to /etc/nginx/sites-available/default, replacing api.mydomain.com and admin.mydomain.com with your actual domains.

server {
    listen 80;
    server_name api.mydomain.com;

    location / {
        proxy_pass http://127.0.0.1:8083;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    location /privacy-policy/ {
        root /var/www/html;
        try_files $uri $uri/ =404;
    }
}

server {
    listen 80;
    server_name admin.mydomain.com;

    location / {
        proxy_pass http://127.0.0.1:8084;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    location /privacy-policy/ {
        root /var/www/html;
        try_files $uri $uri/ =404;
    }
}
  1. Ensure http mapping is present

    Ensure that the http section in /etc/nginx/nginx.conf contains the following configuration:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}
If not, add it at the top of the `http` section.
  1. Reload Nginx to apply changes
sudo nginx -s reload
  1. Verify Nginx is running
sudo systemctl status nginx
  1. Setup SSL with Let’s Encrypt

    Remember to replace the domains.

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d api.mydomain.com -d admin.mydomain.com

Environment setup

To set up the environment, follow the detailed instructions for the variant you're interested in:

  1. I have one server for the system and a separate MSSQL server

  2. I have only one server (no separate MSSQL server)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors