Privatization Deployment Dashboard

Dashboard - Community

The dashboard is the AR content manager system. It helps our AR Experience and showcase make more flexible and convenient. And community is an Open source project.
Community Dashboard

Install Environment

Dashboard is developed using Python3.6 and Django 3.2. Before starting to install Python and Django, we must first install the necessary components on the server.
Ubuntu
CentOS
Debian
1
apt-get update
2
apt-get upgrade
3
apt-get install libmysqlclient-dev
Copied!
1
yum mysql-devel
Copied!
1
apt install -y libmariadbd18
2
apt install -y libmariadbd-dev
Copied!

Redis

Our services is using redis to caching the data so we must install it. You can following https://redis.io/topics/quickstart to install the redis for Linux.
1
apt-get install redis-server
Copied!

Python3

First of all, we need to check whether Python 3 is installed in the current system. Execute the following command to check.
1
# Run python
2
python
3
4
# Stop python
5
exit()
Copied!
If you are not Python3, you must install or upgrade to Python3.

Create Virtual Environment

Now we have completed the installation of the environment. We can create an Virtual Environment for AR-MOD Dashboard and activated. Execute the following command to create.
1
cd /home
2
mkdir virtualenv
3
cd virtualenv
4
python3 -m venv armod_env
5
cd armod_env
6
source bin/activate
7
mkdir codes
8
cd codes
Copied!

Install Git

Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
Execute the following command to Install.
1
apt-get install git
Copied!

Clone the Services

Let's clone the AR-MOD Dashboard Community version repository from github to your virtual environment.
1
git clone https://github.com/Phantomxm2021/ARMOD-Dashboard.git
Copied!
Wait for the clone to complete. Go to the ARMODServices folder and execute the following command to install AR-MOD Dashboard dependencies.
1
cd armod-dashboard/ARMODServers
2
python -m pip install --upgrade pip
3
pip3 install -r requirements.txt
Copied!

Setup ARMOD Servers Configure

AR Experience storage setup

  1. 1.
    Go to the ARMODServers folder
  2. 2.
    Find and modify the ARMODServers/settings.py
We are using the Aliyun OSS to store our AR-Experience resources, if you have not the account you must register one.
1
# Aliyun OSS
2
OSS_ACCESS_KEY_ID = "YOUR_OSS_ACCESS_KEY_ID"
3
OSS_ACCESS_KEY_SECRET = "YOUR_OSS_ACCESS_KEY_SECRET"
4
OSS_ENDPOINT="YOUR_OSS_END_POINT"
5
OSS_BUCKET_NAME = "YOUR_BUCKET_NAME"
6
ALIYUN_OSS_ACCESS_URL = 'YOUR_ALIYUN_OSS_ACCESS_URL'
7
OSS_BASE_URL = 'YOUR_OSS_BASE_URL'
8
Copied!

Database setup

  1. 1.
    Install the mysql.
  2. 2.
    Go to the ARMODServers folder.
  3. 3.
    Find and modify the ARMODServers/settings.py .
1
DATABASES = {
2
'default': {
3
'ENGINE': 'django.db.backends.mysql',
4
+ 'NAME': 'DB_NAME',
5
+ 'USER': 'DB_USER',
6
+ 'PASSWORD': 'DB_PASSWORLD',
7
+ 'HOST':'DB_LOCALTION',
8
'PORT': '3306',
9
'OPTIONS': {
10
"init_command": "SET sql_mode='STRICT_TRANS_TABLES'",
11
},
12
}
13
}
Copied!

Email setup

  1. 1.
    Go to the ARMODServers folder.
  2. 2.
    Find and modify the ARMODServers/settings.py .
1
# Email config
2
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
3
# Whether to use TLS secure transmission protocol (used to provide confidentiality and data integrity between two communication applications.)
4
EMAIL_USE_TLS = False # Use TLS
5
EMAIL_USE_SSL = True # Use SSL
6
EMAIL_HOST = 'YOUR_SMTP_SERVER' # SMTP server
7
EMAIL_PORT = 465 # SMTP server port
8
EMAIL_HOST_USER = 'YOUR_SENDER_EMAIL' # Sender
9
EMAIL_HOST_PASSWORD = 'YOUR_PASSWORD' # Password
10
EMAIL_PROM = 'YOUR_SENDER_INFOMATION' # Sender infomation, e.g. ARMOD<[email protected]>
Copied!

Run uWSGI

uWSGI is a software application that "aims at developing a full stack for building hosting services". It is named after the Web Server Gateway Interface (WSGI), which was the first plugin supported by the project. uwsgi (all lowercase) is the native binary protocol that uWSGI uses to communicate with other servers.
1
#Back to the project root directory
2
cd ..
3
uwsgi --ini uwsgi.ini
Copied!
We have provide the shell command to start/restart/stop the uwsgi. You can execute it in the server like ./restart_uwsgi.sh start .

Run Supervisord

Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
We using the Supervisord to listen Celery(Task Queue), and Celery will send emails to new users when they register for an account.
We can execute the following command to run it.
1
#Install supervisor
2
apt install supervisor
3
4
# Run it
5
sudo supervisord -c supervisord.conf
Copied!

Nginx

Nginx (pronounced engine-x) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server.
A web server faces the outside world. It can serve files (HTML, images, CSS, etc) directly from the file system. However, it can’t talk directly to Django applications; it needs something that will run the application, feed it requests from web clients (such as browsers) and return responses.
A Web Server Gateway Interface - WSGI - does this job. WSGI is a Python standard.
uWSGI is a WSGI implementation. In this tutorial we will set up uWSGI so that it creates a Unix socket, and serves responses to the web server via the uwsgi protocol. At the end, our complete stack of components will look like this:
Stack of components
Execute the following command to Install.
Install Nginx
1
apt-get update
2
apt-get upgrade
3
apt-get install Ngnix
Copied!

Configure nginx for you

We need to modify the Nginx configure file, let nginx listen the uwsgi.
Execute the following command to find the nginx, the nginx configure file will be in the /etc/nginx/sites-enabled path.
1
whereis nginx
2
cd /etc/nginx/sites-enabled
Copied!
Now you can using the vim to modify the default configure file.
It’s best to make a backup copy before making changes.
Backup
1
mv /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/default_backup
Copied!
Modify
1
vim /etc/nginx/sites-enabled/default
Copied!
Default
1
server {
2
listen 80;
3
+ server_name YOUR_DOMAIN;
4
rewrite ^(.*)$ https://$host$1;
5
6
location / {
7
index index.html index.htm;
8
}
9
}
10
11
server {
12
listen 443 ssl;
13
+ server_name YOUR_DOMAIN
14
root html;
15
index index.html index.htm;
16
+ ssl_certificate home/virtualenv/armod_env/codes/armod-dashboard/ARMODServers/Certificate/YOUR_PEM;
17
+ ssl_certificate_key /home/virtualenv/armod_env/codes/armod-dashboard/ARMODServers/Certificate/YOUR_KEY;
18
ssl_session_timeout 5m;
19
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
20
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
21
ssl_prefer_server_ciphers on;
22
23
location / {
24
include uwsgi_params;
25
uwsgi_pass 127.0.0.1:8000;
26
client_max_body_size 20m;
27
}
28
29
location /static {
30
alias /home/virtualenv/armod_env/codes/armod-dashboard/ARMODServers/static_collections;
31
}
32
}
33
Copied!
ssl_certificate & ssl_certificate_key must be in ARMODServers/Certificate folder
After modification, we can use nginx -t to check whether the configuration is successful.
1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2
nginx: configuration file /etc/nginx/nginx.conf test is successful
Copied!
Now we can restart the Nginx with nginx -s reload.
Then we need to create an empty folder to store static files. execute the following command to create.
1
mkdir static_collections
2
3
python manage.py collectstatic
Copied!
Rest the nginx and uwsgi.
1
sh restart_uwsgi.sh restart
2
nginx -s reload
Copied!

Summary

Through the above installation and settings, we can access the current dashboard through ip or url. And Community version dashboard is full support the REST API and all of features, but not data collection, analysis.
Typing your domain to access AR-MOD dashboard. You will see the login page like below:
Login
Last modified 1mo ago