### Install PostgreSQL Database on Ubuntu Source: https://mikrowizard.com/docs/install-mikrowizard-manual Installs the PostgreSQL database system on Ubuntu using the apt package manager. ```Bash sudo apt install postgresql ``` -------------------------------- ### Install Redis Server on Ubuntu Source: https://mikrowizard.com/docs/install-mikrowizard-manual Installs the Redis server on Ubuntu using the apt package manager. It is a prerequisite for setting up Redis with Time Series functionality. ```Bash sudo apt install redis-server ``` -------------------------------- ### Run MikroWizard Server (Bash) Source: https://mikrowizard.com/docs/install-mikrowizard-manual This command initiates the MikroWizard server using uWSGI in production mode. It specifies the uWSGI configuration file to be used. This is the final step to get the MikroWizard application running. ```bash /usr/local/bin/uwsgi --ini /app/conf/uwsgi.ini:uwsgi-production ``` -------------------------------- ### Install and Verify Nginx on Ubuntu Source: https://mikrowizard.com/docs/install-mikrowizard-manual Installs Nginx web server on Ubuntu using apt package manager and reloads the service. Verifies installation by checking for the default Nginx landing page in a web browser. ```Bash sudo apt update sudo apt install nginx sudo systemctl reload nginx ``` -------------------------------- ### Verify Redis Installation Source: https://mikrowizard.com/docs/install-mikrowizard-manual Verifies the Redis installation by connecting to the Redis server using the redis-cli and executing the INFO command, which returns detailed information about the Redis server. ```Bash redis-cli INFO ``` -------------------------------- ### Create Directories and Config Files (Bash) Source: https://mikrowizard.com/docs/install-mikrowizard-manual This script creates necessary directories for configuration and application data, sets ownership for these directories, and copies a default server configuration file. It ensures the environment is ready for MikroWizard's configuration. ```bash export USER=$(whoami) && sudo mkdir /conf && sudo chown $USER:$USER /app mkdir /conf/firms mkdir /conf/backups cp /app/conf/server-config.json /conf/ ``` -------------------------------- ### Verify PostgreSQL Installation Source: https://mikrowizard.com/docs/install-mikrowizard-manual Verifies the PostgreSQL installation by attempting to connect to a specific database using a created username and password via the psql command-line interface. ```Bash psql -U your_username -d your_database_name ``` -------------------------------- ### Clone MikroMan Repository and Set Permissions Source: https://mikrowizard.com/docs/install-mikrowizard-manual Creates an '/app' directory, sets ownership to the current user, and clones the MikroWizard/mikroman Git repository into it. This prepares the environment for MikroMan installation. ```Bash export USER=$(whoami) && sudo mkdir /app && sudo chown $USER:$USER /app git clone git@github.com:MikroWizard/mikroman.git /app ``` -------------------------------- ### Install Python Dependencies for MikroMan Source: https://mikrowizard.com/docs/install-mikrowizard-manual Downloads and installs the latest pip, then installs the uWSGI package and project-specific requirements from 'reqs.txt' within the MikroMan application directory. ```Bash 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 ``` -------------------------------- ### Download and Extract MikroFront Source: https://mikrowizard.com/docs/install-mikrowizard-manual Downloads the latest MikroFront release archive from GitHub and extracts its contents to the Nginx web root directory for serving static files. ```Bash 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/ ``` -------------------------------- ### Install MikroWizard with Docker (Bash) Source: https://mikrowizard.com/docs/install-the-mikrowizard This script installs MikroWizard and all its dependencies, including Redis, PostgreSQL, backend, and frontend containers, along with Python3, cron, and bash scripts. Ensure your server has an active internet connection. The script will prompt for database credentials, server IP, RADIUS secret, and firmware/backup storage paths. ```bash sudo su -c "bash <(wget -qO- https://gist.githubusercontent.com/s265925/84f8fdc90c8b330a1501626a50e983a1/raw/b1fc4e0f283fd48d78861fa1a665fd1cb19b734d/installer.sh)" root ``` -------------------------------- ### Create PostgreSQL User and Database Source: https://mikrowizard.com/docs/install-mikrowizard-manual Creates a new PostgreSQL user with a specified password and a new database owned by that user. It then exits the PostgreSQL command-line interface. ```Bash sudo -i -u postgres psql CREATE USER your_username WITH PASSWORD 'your_password'; CREATE DATABASE your_database_name OWNER your_username; \q exit ``` -------------------------------- ### Configure Nginx for MikroFront Source: https://mikrowizard.com/docs/install-mikrowizard-manual Updates the default Nginx site configuration to serve MikroFront static files and proxy API requests to the backend server. This includes setting up root directory, proxy pass for /api, and version endpoint. ```Bash cd /etc/nginx/sites-available/ sudo nano /etc/nginx/sites-enabled/default ``` ```Nginx 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; } } ``` -------------------------------- ### Migrate Database and Import Data (Bash) Source: https://mikrowizard.com/docs/install-mikrowizard-manual This bash script executes the database migration process and imports default records into the database. It sets up the Python environment, specifies the configuration path, runs the migration script, and then uses psql to import data from the SQL file. Ensure you replace placeholders in the SQL file before running this command. ```bash 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 ``` -------------------------------- ### Configure Server Settings (JSON) Source: https://mikrowizard.com/docs/install-mikrowizard-manual This JSON file contains the server configuration parameters for MikroWizard. Users need to replace placeholder values with their specific database credentials, encryption keys, and other essential settings. This file is crucial for the server's operation. ```json { "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": "*" } ``` -------------------------------- ### Prepare Database Schema and Data (SQL) Source: https://mikrowizard.com/docs/install-mikrowizard-manual This SQL script defines default records to be inserted into the database. It includes placeholders for the server IP address and radius secret that need to be customized before execution. This script populates the database with necessary initial data. ```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 .... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.