Skip to content

Commit

Permalink
deployment docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
BryonLewis committed Feb 21, 2024
1 parent ae16c2e commit c6078f4
Showing 1 changed file with 44 additions and 6 deletions.
50 changes: 44 additions & 6 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,55 @@ for accessing the server.
3. Run `docker compose run --rm django ./manage.py makeclient \
--username [email protected] \
--uri https://batdetectai.kitware.com/`
4. Run `docker compose run --rm django ./manage.py collectstatic`
4. Run `docker compose run --rm django ./manage.py loaddata species` to load species
data into the database
5. Run `docker compose run --rm django ./manage.py collectstatic`
to collect the static files
5. Run `docker compose -f docker-compose.prod.yml up` to start the server
6. Run `docker compose -f docker-compose.prod.yml up` to start the server
add `-d` for a silent version to run in the background
6. Copy over the ./dev/.env.prod.docker-compose.template
7. Copy over the ./dev/.env.prod.docker-compose.template
to `./dev/.env.prod.docker-compose.template` and change the default passwords
7. Change the ID in the `./client/env.production` to a custom ID
8. After creating the basic application log into the django admin `batdetectai.kitware.com/admin`
8. Change the ID in the `./client/env.production` to a custom ID - this will
probably require a `docker compose build` to build the app afterwards
9. After creating the basic application log into the django admin `batdetectai.kitware.com/admin`
and change the ApplicationId to the ID in the `./client.env.production`
9. Test logging in/out and uploading data to the server.
10. Test logging in/out and uploading data to the server.

### system.d service

Service that will automatically start and launch the server
Create this at `/etc/systemd/system` using sudo

```systemd
[Unit]
Description=batai-server
Requires=docker.service
After=docker.service
[Service]
ExecStartPre=/bin/sleep 10
Environment=PATH=/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
Restart=always
User=bryon
Group=docker
TimeoutStartSec=300
RestartSec=20
WorkingDirectory=/home/bryon/batai
# Shutdown container (if running) when unit is started
ExecStartPre=docker compose down
# Start container when unit is started
ExecStart=docker compose -f docker-compose.prod.yml up
# Stop container when unit is stopped
ExecStop=docker compose down
[Install]
WantedBy=multi-user.target
```

After run `sudo systemctl enable batai.service`
Then to start you can use `sudo systemctl start batai.service`
Stopping: `sudo systemctl stop batai.service`

# User Management

There is no email server connected up so users need to be individually approved and their email verified by an admin

0 comments on commit c6078f4

Please sign in to comment.