To install and configure Nginx, Redis with Time Series, and PostgreSQL Database on Ubuntu, follow these step-by-step instructions:
Install Nginx: #
Open the terminal and run the following commands: #
sudo apt update
sudo apt install nginx
sudo systemctl reload nginx
MikroWizard Nginx installation Verify Nginx installation: #
In your web browser, type in your server’s IP address. You should see the default Nginx landing page.
Install Redis with Time Series: #
The Time series
module comes either as a separate module or as part of the Redis Stack solution. If you don’t want to install Redis Stack (which is the best option), you can install the TimeSeries module separately:
- To install Redis Stack :
Please follow this link from Redis official website: - Install Redis and add a time series module:
- First, install redis-server
sudo apt install redis-server
MikroWizard Redis installation - Follow the instructions on Redis official website
Verify Nginx installation: #
redis-cli INFO
MikroWizard Redis installation Install PostgreSQL Database #
Open the terminal and run the following commands: #
sudo apt install postgresql
MikroWizard PostgreSQL installation Create a new PostgreSQL user and database: #
sudo -i -u postgres
psql
CREATE USER your_username WITH PASSWORD 'your_password';
CREATE DATABASE your_database_name OWNER your_username;
\q
exit
MikroWizard PostgreSQL installation Verify PostgreSQL installation: #
Access PostgreSQL command line interface
psql -U your_username -d your_database_name
MikroWizard PostgreSQL installation Installing MikroFront: #
download and extract the latest front build
wget https://github.com/MikroWizard/mikrofront/releases/download/1.0.0-beta/mikrofront-1.0.0-beta.tar.gz
tar -xpzf mikrofront-1.0.0-beta.tar.gz -C /usr/share/nginx/html/
MikroWizard MikroFront installation Navigate to the Nginx configuration directory and edit the configuration file:
cd /etc/nginx/sites-available/
sudo nano /etc/nginx/sites-enabled/default
MikroWizard MikroFront installation Replace config with the following config
server {
listen 80;
sendfile on;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ /index.html =404;
}
location /api {
proxy_pass http://host.docker.internal:8181;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $realip_remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
location /api/frontver {
add_header Cache-Control 'no-store';
add_header Cache-Control 'no-cache';
expires 0;
index version.json;
alias /usr/share/nginx/html;
}
}
MikroWizard MikroFront installation Installing MikroMan: #
Create a folder with your current user ownership
export USER=$(whoami) && sudo mkdir /app && sudo chown $USER:$USER /app
git clone [email protected]:MikroWizard/mikroman.git /app
MikroWizard MikroMan installation Install the latest pip and install requirements #
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
pip install uWSGI==2.0.22
cd /app && pip isntall -r reqs.txt
MikroWizard MikroMan installation Create config files and directories #
export USER=$(whoami) && sudo mkdir /conf && sudo chown $USER:$USER /app
mkdir /conf/firms
mkdir /conf/backups
cp /app/conf/server-config.json /conf/
MikroWizard MikroMan installation Edit /conf/server-config.json and change the following lines: #
– Replace “YOUR_DATABASE_USERNAME” with the custom username for the database that was created before
– Replace “YOUR_DATABASE_PASSWORD” with the custom password for the database that was created before
– Replace “YOUR_CRYPT_KEY” with the private key that you created for data encryption
{
"name": "python server config template - rename me",
"PYSRV_IS_PRODUCTION": "1",
"PYSRV_DATABASE_HOST": "127.0.0.1",
"PYSRV_DATABASE_HOST_POSTGRESQL": "127.0.0.1",
"PYSRV_DATABASE_PORT": "5432",
"PYSRV_DATABASE_NAME": "_YOUR_DATABASE_NAME_",
"PYSRV_DATABASE_USER": "_YOUR_DATABASE_USERNAME_",
"PYSRV_DATABASE_PASSWORD": "_YOUR_DATABASE_PASSWORD_",
"PYSRV_CRYPT_KEY": "_YOUR_CRYPT_KEY_",
"PYSRV_BACKUP_FOLDER":"/conf/backups/",
"PYSRV_FIRM_FOLDER":"/conf/firms/",
"PYSRV_COOKIE_HTTPS_ONLY": false,
"PYSRV_REDIS_HOST": "127.0.0.1:6379",
"PYSRV_DOMAIN_NAME": "",
"PYSRV_CORS_ALLOW_ORIGIN": "*"
}
MikroWizard MikroMan installation Import default db records to the database: #
First change lines in file /app/conf/db.sql
....
15 INSERT INTO public.sysconfig( key, value) VALUES ( 'default_ip', '$serverip');
-- change $serverip with your server ip
16 INSERT INTO public.sysconfig( key, value) VALUES ( 'rad_secret', '$secret');
-- change $secret with your radius secret
17 INSERT INTO public.sysconfig( key, value) VALUES ( 'system_url', 'http://$serverip');
-- change $serverip with your server ip
....
MikroWizard MikroMan installation Add tables and default data to the Datase
cd /app/;export PYTHONPATH=/app/py; export PYSRV_CONFIG_PATH=/conf/server-conf.json;python3 scripts/dbmigrate.py;
psql -U _YOUR_DATABASE_USERNAME_ -d _YOUR_DATABASE_NAME_ -f /app/conf/db.sql
MikroWizard MikroMan installation Running The server: #
/usr/local/bin/uwsgi --ini /app/conf/uwsgi.ini:uwsgi-production
MikroWizard MikroMan installation Finish #
Now you can navigate with the browser and start using MikroWizard
Username: mikrowizard
Password: mikrowizard