File tree Expand file tree Collapse file tree 9 files changed +84
-4
lines changed
Expand file tree Collapse file tree 9 files changed +84
-4
lines changed Original file line number Diff line number Diff line change 1+ DRGON_POSTGRES_PORT = XXXXXX
2+ DRGON_POSTGRES_ADMIN_PASSWORD = XXXXXX
Original file line number Diff line number Diff line change 1+ src /node_modules /*
2+ .env
Original file line number Diff line number Diff line change 11FROM ubuntu:22.04
22USER root
33
4+ ARG DRGON_POSTGRES_ADMIN_PASSWORD="admin"
5+
46RUN apt update
57
68# Install sudo (required by Ansible)
Original file line number Diff line number Diff line change 11FROM ubuntu:20.04
22
3+ ARG DRGON_POSTGRES_ADMIN_PASSWORD="admin"
34ARG DEBIAN_FRONTEND=noninteractive
45RUN apt update
56
Original file line number Diff line number Diff line change 2626 create : yes
2727 - name : Set postgres' password
2828 become_user : postgres
29- community.postgresql.postgresql_query :
30- query : ALTER USER postgres PASSWORD 'admin';
29+ community.postgresql.postgresql_user :
30+ name : postgres
31+ password : " {{ lookup('env', 'DRGON_POSTGRES_ADMIN_PASSWORD') }}"
3132 - name : Create new Postgres database
3233 become_user : postgres
3334 community.postgresql.postgresql_db :
Original file line number Diff line number Diff line change 1+ echo " Building DRGON... this should only take a few minutes."
2+ sh .env
3+
4+ export ENV_LOADED_STATUS=$( echo $? )
5+ if [[ $ENV_LOADED_STATUS -ne 0 ]]; then
6+ echo " Error: Could not load .env file."
7+ exit 1
8+ fi
9+
10+ command -v docker | export DOCKER_INSTALLED=$?
11+ command -v docker-compose | export DOCKER_COMPOSE_INSTALLED=$?
12+
13+
14+ if [[ $DOCKER_INSTALLED -ne 0 ]]; then
15+ echo " Error: Docker is not installed on this machine."
16+ exit 1
17+ fi
18+
19+ if [[ $DOCKER_COMPOSE_INSTALLED -ne 0 ]]; then
20+ echo " Error: Docker Compose is not installed on this machine."
21+ exit 1
22+ fi
23+
24+ docker compose build --build-arg DRGON_POSTGRES_ADMIN_PASSWORD
25+
26+ export BUILD_STATUS=$( echo $? )
27+ if [[ $BUILD_STATUS -ne 0 ]]; then
28+ echo " Error: DRGON did not build successfully."
29+ exit 1
30+ fi
31+
32+ echo " Done! You can start your DRGON instance by running the 'start.sh' script."
33+ exit 0
34+
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ services:
99 ports :
1010 - " 8000:8000"
1111 hostname : drgon-server
12+ environment :
13+ DRGON_POSTGRES_ADMIN_PASSWORD : ${DRGON_POSTGRES_ADMIN_PASSWORD}
1214 networks :
1315 - drgon-network
1416 drgon-postgres :
@@ -17,8 +19,10 @@ services:
1719 dockerfile : ./Dockerfiles/Dockerfile.drgon-postgres
1820 image : ghcr.io/geocml/drgon:postgres
1921 ports :
20- - " 5433 :5433"
22+ - " ${DRGON_POSTGRES_PORT} :5433"
2123 hostname : drgon-postgres
24+ environment :
25+ DRGON_POSTGRES_ADMIN_PASSWORD : ${DRGON_POSTGRES_ADMIN_PASSWORD}
2226 networks :
2327 - drgon-network
2428networks :
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { wipeDB } from "./utils.js"
33
44const pgp = pgPromise ( { } )
55
6- export const db = pgp ( " postgres://postgres:admin @drgon-postgres:5433/drgon_db" )
6+ export const db = pgp ( ` postgres://postgres:${ process . env . DRGON_POSTGRES_ADMIN_PASSWORD } @drgon-postgres:5433/drgon_db` )
77
88db . connect ( )
99 . then ( async ( obj ) => {
Original file line number Diff line number Diff line change 1+ echo " Starting DRGON... this should only take a moment."
2+ sh .env
3+
4+ export ENV_LOADED_STATUS=$( echo $? )
5+ if [[ $ENV_LOADED_STATUS -ne 0 ]]; then
6+ echo " Error: Could not load .env file."
7+ exit 1
8+ fi
9+
10+ command -v docker | export DOCKER_INSTALLED=$?
11+ command -v docker-compose | export DOCKER_COMPOSE_INSTALLED=$?
12+
13+
14+ if [[ $DOCKER_INSTALLED -ne 0 ]]; then
15+ echo " Error: Docker is not installed on this machine."
16+ exit 1
17+ fi
18+
19+ if [[ $DOCKER_COMPOSE_INSTALLED -ne 0 ]]; then
20+ echo " Error: Docker Compose is not installed on this machine."
21+ exit 1
22+ fi
23+
24+ docker compose up -d
25+
26+ export START_STATUS=$( echo $? )
27+ if [[ $START_STATUS -ne 0 ]]; then
28+ echo " Error: DRGON did not start successfully."
29+ exit 1
30+ fi
31+
32+ echo " Done! You can stop your DRGON instance at any time with 'docker compose down'."
33+ exit 0
34+
You can’t perform that action at this time.
0 commit comments