Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .env.dockercompose
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# COMMONS
MONGODB_URI=
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=

# ARC3
GUILD_ID=
TOKEN=

# ARC3 API
CLIENT_REDIRECT_URI=
DIRECT_URL=
DISCORD_REDIRECT_URI=
FULLCHAIN=
HOSTED_URL=
JWT_SECRET=
API_PORT=
PRIVKEY=

# UNITY
UNITY_PORT=
UNITY_API_BASE_URI=
UNITY_BASE_URI=
UNITY_DEBUG=
USE_HTTPS=
STATUS_SITE_URL=
SITE_TITLE=
SITE_DESCRIPTION_META=
SITE_DESCRIPTION=
SITE_HERO_IMAGE=

# MONGO
MONGO_INITDB_ROOT_PASSWORD=

# AWS
AWS_REGION=
AWS_ACCOUNT_ID=
AWS_UNITY_REPO_NAME=
AWS_ARC3_REPO_NAME=
AWS_ARC3_API_REPO_NAME=



66 changes: 42 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,52 @@ The arc system can be run easily using the docker-compose file provided

First you should set up your `.env` file as follows
```ini
TOKEN='TOKEN' # This should be your discord bot application token obtained from the discord developer portal.

MONGODB_URI='mongodb://root:<password>@mongo:27017/Arc3?authSource=admin' # passwords here and the mongo_inidn_root_password should match
MONGO_INITDB_ROOT_PASSWORD=<password>

GUILD_ID='id' # TEMPORORY - Currently the system will only fully function on one main server. Input it's ID here.

BUILD_PATH='../arc3-dash/build' # This is set to wherever your react client build will be relative to the expess server.

DISCORD_CLIENT_ID="id" # Discord application client id obtained from the discord developer portal.
DISCORD_CLIENT_SECRET="secret" # discord application client secret obtained from the discord developer portal.

DISCORD_REDIRECT_URI="<base_uri>/auth/callback" # only change the base_uri part unless you know what you are doing. This will control where the user is redirected apon login. The base_uri shoudl match the one found in the client_redirect_url variable and the hosted_url

JWT_SECRET="secret" # the secret used for JWT signing of the session tokens.

CLIENT_REDIRECT_URL="<base_uri>" # This is where the user will be redirected after logging in sucessfully.

DIRECT_URL="" # This is the oauth2 url that is generated by discord for the login link. Create this in the discord developer portal.


HOSTED_URL="<base_uri>" # the base uri where the client and server are hosted.
# COMMONS
MONGODB_URI=
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=

# ARC3
GUILD_ID=
TOKEN=

# ARC3 API
CLIENT_REDIRECT_URI=
DIRECT_URL=
DISCORD_REDIRECT_URI=
FULLCHAIN=
HOSTED_URL=
JWT_SECRET=
API_PORT=
PRIVKEY=

# UNITY
UNITY_PORT=
UNITY_API_BASE_URI=
UNITY_BASE_URI=
UNITY_DEBUG=
USE_HTTPS=
STATUS_SITE_URL=
SITE_TITLE=
SITE_DESCRIPTION_META=
SITE_DESCRIPTION=
SITE_HERO_IMAGE=

# MONGO
MONGO_INITDB_ROOT_PASSWORD=

# AWS
AWS_REGION=
AWS_ACCOUNT_ID=
AWS_UNITY_REPO_NAME=
AWS_ARC3_REPO_NAME=
AWS_ARC3_API_REPO_NAME=

```

Then, simply install docker and docker compose and then run it with this command.
Then, simply install docker and docker compose and then run it with the deploy script
```
docker compose up -d
./deploy.sh
```

## Components
Expand Down
12 changes: 8 additions & 4 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
git pull
git submodule update
docker compose -f docker-compose.yml build
docker compose -f docker-compose.yml up -d
export $(cat .env | xargs)
aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com

export ARC3_API_VER=`aws ecr describe-images --repository-name $AWS_ARC3_API_REPO_NAME --query 'sort_by(imageDetails,& imagePushedAt)[-1]' | jq -r '.imageTags[0]'`
export UNITY_VER=`aws ecr describe-images --repository-name $AWS_UNITY_REPO_NAME --query 'sort_by(imageDetails,& imagePushedAt)[-1]' | jq -r '.imageTags[0]'`
export ARC3_VER=`aws ecr describe-images --repository-name $AWS_ARC3_REPO_NAME --query 'sort_by(imageDetails,& imagePushedAt)[-1]' | jq -r '.imageTags[0]'`

docker compose -f docker-compose.yml up
156 changes: 76 additions & 80 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,86 @@ version: '3.8'

services:

mongo:
image: mongo:7.0
env_file:
- .env
container_name: mongo
restart: always
networks:
- common-net
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
volumes:
- mongo_data:/data/db
- mongo_config:/data/configdb
- ./keys/mongo.keyfile:/data/mongo.keyfile
ports:
- 27017:27017
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh mongo:27017/arc3 --quiet
interval: 10s
timeout: 10s
retries: 5
start_period: 40s
unity:
environment:
- PORT=${UNITY_PORT}
- UNITY_API_BASE_URI=${UNITY_API_BASE_URI}
- UNITY_BASE_URI=${UNITY_BASE_URI}
- UNITY_DEBUG=${UNITY_DEBUG}
- USE_HTTPS=${USE_HTTPS}
- STATUS_SITE_URL=${STATUS_SITE_URL}
- SITE_TITLE=${SITE_TITLE}
- SITE_DESCRIPTION_META=${SITE_DESCRIPTION_META}
- SITE_DESCRIPTION=${SITE_DESCRIPTION}
- SITE_HERO_IMAGE=${SITE_HERO_IMAGE}
image: 140023379914.dkr.ecr.us-east-2.amazonaws.com/unity:${UNITY_VER}
depends_on:
- arc3-api
container_name: unity
restart: on-failure
ports:
- 3040:${UNITY_PORT}

arc3:
env_file:
- .env
depends_on:
- mongo
image: arc3
build:
dockerfile: arc3.Dockerfile
container_name: arc3
networks:
- common-net
arc3:
environment:
- MONGODB_URI=${MONGODB_URI}
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID}
- DISCORD_CLIENT_SECRET=${DISCORD_CLIENT_SECRET}
- GUILD_ID=${GUILD_ID}
- TOKEN=${TOKEN}
image: 140023379914.dkr.ecr.us-east-2.amazonaws.com/arc3:${ARC3_VER}
container_name: arc3
restart: on-failure

arc-api:
env_file:
- .env
depends_on:
- arc3
image: arc3-api
build:
dockerfile: arc3-api.Dockerfile
args:
- fullchain=${FULLCHAIN}
- privkey=${PRIVKEY}
container_name: arc3-api
restart: on-failure
ports:
- 3030:3030
networks:
- common-net
arc3-api:
environment:
- MONGODB_URI=${MONGODB_URI}
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID}
- DISCORD_CLIENT_SECRET=${DISCORD_CLIENT_SECRET}
- CLIENT_REDIRECT_URI=${CLIENT_REDIRECT_URI}
- DIRECT_URL=${DIRECT_URL}
- DISCORD_REDIRECT_URI=${DISCORD_REDIRECT_URI}
- FULLCHAIN=${FULLCHAIN}
- HOSTED_URL=${HOSTED_URL}
- JWT_SECRET=${JWT_SECRET}
- PORT=${API_PORT}
- PRIVKEY=${PRIVKEY}
- TOKEN=${TOKEN}
image: 140023379914.dkr.ecr.us-east-2.amazonaws.com/arc3-api:${ARC3_API_VER}
container_name: arc3-api
restart: on-failure
ports:
- 3060:${API_PORT}

arc-tasks:
env_file:
- .env
depends_on:
- mongo
image: arc-tasks
build:
dockerfile: arc3-tasks.Dockerfile
container_name: arc3-tasks
networks:
- common-net
labels:
ofelia.enabled: "true"
ofelia.job-exec.data-compliance.schedule: "@every 12h"
ofelia.job-exec.data-compliance.command: "node data-compliance.js"
ofelia.job-exec.backup-db.schedule: "@every 24h"
ofelia.job-exec.backup-db.command: "node backup-db.js Guilds appeals comments guild_configs transcripts user_notes"
volumes:
- ./db-backups:/app/out
mongo:
image: mongo:7.0
env_file:
- .env
container_name: mongo
restart: always
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
volumes:
- mongo_data:/data/db
- mongo_config:/data/configdb
- ./keys/mongo.keyfile:/data/mongo.keyfile
ports:
- 27018:27017

scheduler:
container_name: scheduler
networks:
- common-net
image: mcuadros/ofelia:latest
depends_on:
- arc-tasks
command: daemon --docker -f label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
mongo_admin_ui:
image: mongo-express
env_file:
- .env
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=root
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
- ME_CONFIG_MONGODB_SERVER=mongo
- ME_CONFIG_BASICAUTH_USERNAME=admin
- ME_CONFIG_BASICAUTH_PASSWORD=${EXPRESS_PWRD}
container_name: mongo_admin_ui
ports:
- 8081:8081

networks:
common-net: {}
Expand Down
Loading