143 lines
3.7 KiB
Markdown
143 lines
3.7 KiB
Markdown
# Deighton AR Training System
|
|
|
|
This is the repository for the Deighton AR Training System.
|
|
|
|
## Development
|
|
|
|
### Pre-requisites
|
|
|
|
Install locally:
|
|
|
|
- NodeJS
|
|
- MongoDB
|
|
- RabbitMQ
|
|
- Redis
|
|
|
|
The backend systems for this project have been developed and tested on macOS and Ubuntu systems.
|
|
|
|
Follow the instructions for additional dependencies for the [`canvas`](https://www.npmjs.com/package/canvas) NPM package.
|
|
|
|
For iOS development install Xcode. For Android development install Android Studio.
|
|
|
|
### Website, Server and Mobile Bundler
|
|
|
|
Ensure the [snap-tool](https://www.npmjs.com/package/snap-tool) is installed with `npm install -g snap-tool`.
|
|
|
|
Clone this repository, and from the root do:
|
|
|
|
```
|
|
snap install
|
|
snap start
|
|
```
|
|
|
|
This will start the website, server and the `Metro` bundler for development builds of the mobile apps.
|
|
|
|
### iOS App
|
|
|
|
You'll need Xcode fully installed and running. To run the iOS mobile app, start Xcode, open the `DeightonAR.xcproject`, plug in a iPhone and run the project.
|
|
|
|
### Android App
|
|
|
|
To run the Android mobile app, start Android Studio, open the `mobile/android` project, plug in an Android device and run the project.
|
|
|
|
## Production
|
|
|
|
### Website
|
|
|
|
To deploy the website for the 1st time do the following.
|
|
|
|
- Install `nginx`, `mongodb`, `rabbitmq` and configure as desired.
|
|
- Order SSL certificate for site and install under `/etc/nginx/ssl`.
|
|
- Install `.conf` file for the site (see below for example)
|
|
|
|
The `.conf` file for the site will look something like:
|
|
|
|
```
|
|
server {
|
|
listen 443 ssl;
|
|
server_name dar.kss.us.com;
|
|
ssl_certificate /etc/nginx/ssl/dar_kss_us_com_chained.crt;
|
|
ssl_certificate_key /etc/nginx/ssl/dar_kss_us_com.key;
|
|
ssl_session_cache shared:SSL:1m;
|
|
ssl_session_timeout 5m;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
root /home/ubuntu/deighton-ar/website;
|
|
|
|
# Any route that starts with /api/ is for the backend
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:3001/;
|
|
proxy_buffering off;
|
|
proxy_redirect off; # The backend doesn't redirect
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_http_version 1.1;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Server $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
# Any route containing a file extension
|
|
location ~ ^.+\..+$ {
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Any route that doesn't have a file extension
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|
|
```
|
|
|
|
Run `nginx -t` to check configuration, then `nginx -s reload` to load it. API service will need to be set up to login (see next section).
|
|
|
|
Create `admin` and `user` users with passwords for the MongoDB database.
|
|
|
|
Install the `deighton-ar.service` file by copying it to the `/lib/systemd/system` directory and run `sudo systemctl --now enable deighton-ar` to start the service.
|
|
|
|
Create a `service/config/local-production.json5` file an insert an MongoDB URI with appropriate password.
|
|
|
|
For subsequent deployments, you can simply run:
|
|
|
|
```
|
|
cd website
|
|
npm run build
|
|
npm run deploy
|
|
```
|
|
|
|
### Service
|
|
|
|
These instructions are for installation on Ubuntu. See [Install_Ubuntu_16.04_LTS_Service_Instance](https://github.com/jlyonsmith/HowTo/blob/master/Install_Ubuntu_16.04_LTS_Service_Instance.md) for detailed instructions on setting up a system appropriately.
|
|
|
|
First, create a log file directories:
|
|
|
|
```
|
|
sudo mkdir /var/log/deighton-ar
|
|
sudo chown ubuntu:ubuntu /var/log/deighton-ar
|
|
```
|
|
|
|
Then do:
|
|
|
|
```
|
|
cd server
|
|
npm run build
|
|
npm run deploy
|
|
```
|
|
|
|
Then, on the server run:
|
|
|
|
```
|
|
|
|
```
|
|
|
|
### iOS App
|
|
|
|
You'll need an Apple Developer account. Set up appropriate AppID's in the developer port with plus signing keys installed correctly. Adjust project to use appropriate siging keys.
|
|
|
|
TBD.
|
|
|
|
### Android App
|
|
|
|
TBD.
|