Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Add postgres docker compose setup #6759

Merged
merged 23 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b3cd6a6
streamline mysql and postgresl docker network settings
4ludwig4 Jun 19, 2023
7c89e85
streamline postgresql naming to postgres in docker compose
4ludwig4 Jun 22, 2023
a018b65
created dev.env with all development configurations for artemis
4ludwig4 Jun 22, 2023
d54abf6
refactored and added documentation to .env files
4ludwig4 Jun 22, 2023
9976e8e
added postgres setups
4ludwig4 Jun 23, 2023
e7e72c5
add postgres setups in docs with file permission tips for admins
4ludwig4 Jun 23, 2023
fc57de6
Merge branch 'develop' into feature/docker/postgresql-setups
4ludwig4 Jun 23, 2023
5f5e94c
Merge branch 'develop' into feature/docker/postgresql-setups
4ludwig4 Jun 28, 2023
9eb9c3a
add clear registry urls for postgres and also mailhog
4ludwig4 Jun 30, 2023
ce2e4b1
Merge remote-tracking branch 'origin/develop' into feature/docker/pos…
4ludwig4 Jun 30, 2023
475489f
Merge remote-tracking branch 'origin/develop' into feature/docker/pos…
4ludwig4 Jul 12, 2023
fd022cf
Merge branch 'develop' into feature/docker/postgresql-setups
4ludwig4 Jul 13, 2023
b9b7046
Merge branch 'develop' into feature/docker/postgresql-setups
4ludwig4 Jul 20, 2023
5191c8d
Merge remote-tracking branch 'origin/develop' into feature/docker/pos…
4ludwig4 Aug 18, 2023
b534ede
fix merge conflicts and adopt postgres cypress settings
4ludwig4 Aug 18, 2023
b2ad4e0
fix missing postgres data volume renaming
4ludwig4 Aug 18, 2023
1f22b34
Merge remote-tracking branch 'origin/develop' into feature/docker/pos…
4ludwig4 Aug 28, 2023
579778a
Merge remote-tracking branch 'origin/develop' into feature/docker/pos…
4ludwig4 Aug 31, 2023
e50d6f0
Update .bamboo/E2E-tests/execute.sh
4ludwig4 Sep 2, 2023
6cde804
Merge branch 'develop' into feature/docker/postgresql-setups
4ludwig4 Sep 2, 2023
6179f77
Merge branch 'develop' into feature/docker/postgresql-setups
4ludwig4 Sep 10, 2023
16d14ee
Update dev.env
4ludwig4 Sep 10, 2023
ea696f1
Merge branch 'develop' into feature/docker/postgresql-setups
4ludwig4 Sep 12, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ data-exports/
!/docker/.docker-data/artemis-data/.gitkeep
/docker/.docker-data/artemis-mysql-data/*
!/docker/.docker-data/artemis-mysql-data/.gitkeep
/docker/.docker-data/artemis-postgres-data/*
!/docker/.docker-data/artemis-postgres-data/.gitkeep

######################
# Cypress
Expand Down
Empty file.
7 changes: 2 additions & 5 deletions docker/artemis-dev-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ services:
# expose the port to make it reachable docker internally even if the external port mapping changes
expose:
- "5005"
environment:
# The following enables the Java Remote Debugging port. More infos in the documentation:
# https://docs.artemis.cit.tum.de/dev/setup.html#debugging-with-docker
_JAVA_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
SPRING_PROFILES_ACTIVE: artemis,scheduling,athena,dev,docker
env_file:
- ./artemis/config/dev.env
depends_on:
mysql:
condition: service_healthy
Expand Down
39 changes: 39 additions & 0 deletions docker/artemis-dev-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis-Dev-Postgres Setup
# ----------------------------------------------------------------------------------------------------------------------

services:
artemis-app:
extends:
file: ./artemis.yml
service: artemis-app
# just add this linux workaround for docker compose in a development version of artemis as developers
# might want to access external services on the docker host
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "8080:8080"
- "5005:5005" # Java Remote Debugging port declared in the java cmd options
# expose the port to make it reachable docker internally even if the external port mapping changes
expose:
- "5005"
env_file:
- ./artemis/config/dev.env
- ./artemis/config/postgres.env
depends_on:
postgres:
condition: service_healthy
postgres:
extends:
file: ./postgres.yml
service: postgres

networks:
artemis:
driver: "bridge"
name: artemis
volumes:
artemis-postgres-data:
name: artemis-postgres-data
artemis-data:
name: artemis-data
6 changes: 4 additions & 2 deletions docker/artemis-migration-check-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
file: ./artemis.yml
service: artemis-app
env_file:
- ./artemis/config/postgres.env
- ./artemis/config/cypress.env
- ./artemis/config/cypress-postgres.env
- ./artemis/config/migration-check.env
depends_on:
Expand All @@ -32,7 +34,7 @@ networks:
driver: "bridge"
name: artemis
volumes:
artemis-postgresql-data:
name: artemis-postgresql-data
artemis-postgres-data:
name: artemis-postgres-data
artemis-data:
name: artemis-data
38 changes: 38 additions & 0 deletions docker/artemis-prod-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis-Prod-Postgres Setup
# ----------------------------------------------------------------------------------------------------------------------

services:
artemis-app:
extends:
file: ./artemis.yml
service: artemis-app
depends_on:
postgres:
condition: service_healthy
restart: on-failure:3
volumes:
- ./.docker-data/artemis-data:/opt/artemis/data
env_file:
- ./artemis/config/postgres.env
postgres:
extends:
file: ./postgres.yml
service: postgres
restart: on-failure:3
volumes:
- ./.docker-data/artemis-postgres-data:/var/lib/postgresql/data
nginx:
extends:
file: ./nginx.yml
service: nginx
# the artemis-app service needs to be started, otherwise there are problems with name resolution in docker
depends_on:
artemis-app:
condition: service_started
restart: on-failure:3

networks:
artemis:
driver: "bridge"
name: artemis
40 changes: 4 additions & 36 deletions docker/artemis/config/cypress-mysql.env
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis configuration overrides for the Cypress E2E MySQL setups
# ----------------------------------------------------------------------------------------------------------------------

SPRING_PROFILES_ACTIVE="artemis,scheduling,bamboo,bitbucket,jira,prod,docker"

SPRING_DATASOURCE_URL="jdbc:mysql://artemis-mysql:3306/Artemis?createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC"
SPRING_DATASOURCE_USERNAME="root"
SPRING_DATASOURCE_PASSWORD=""
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE="100"

SPRING_JPA_DATABASE_PLATFORM="org.hibernate.dialect.MySQL8Dialect"
SPRING_JPA_DATABASE="MYSQL"
SPRING_JPA_HIBERNATE_CONNECTION_CHARSET="utf8mb4"
SPRING_JPA_HIBERNATE_CONNECTION_CHARACTERENCODING="utf8mb4"
SPRING_JPA_HIBERNATE_CONNECTION_USEUNICODE="true"

SPRING_PROMETHEUS_MONITORINGIP="131.159.89.160"

# for bamboo and bitbucket notifications on /api/programming-exercises/new-result it seems like port
# 54321 is internally open for the bamboo agents
# also can't use SSL for this as the hostnames are not integrated in the self-signed certificate
SERVER_URL="http://${HOST_HOSTNAME}:54321"

# We don't need secure passwords for testing. Lower rounds will speed up tests. 4 is the lowest
ARTEMIS_BCRYPTSALTROUNDS="4"

ARTEMIS_USERMANAGEMENT_USEEXTERNAL="true"
ARTEMIS_USERMANAGEMENT_EXTERNAL_URL="https://jira-prelive.ase.in.tum.de"
ARTEMIS_USERMANAGEMENT_EXTERNAL_USER="${bamboo_jira_prelive_admin_user}"
ARTEMIS_USERMANAGEMENT_EXTERNAL_PASSWORD="${bamboo_jira_prelive_admin_password}"
ARTEMIS_USERMANAGEMENT_EXTERNAL_ADMINGROUPNAME="artemis-dev"
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_USERNAME="${bamboo_artemis_admin_username}"
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_PASSWORD="${bamboo_artemis_admin_password}"
ARTEMIS_USERMANAGEMENT_LOGIN_ACCOUNTNAME="TUM"

ARTEMIS_VERSIONCONTROL_URL="https://bitbucket-prelive.ase.in.tum.de"
ARTEMIS_VERSIONCONTROL_USER="${bamboo_jira_prelive_admin_user}"
Expand All @@ -40,22 +27,3 @@ ARTEMIS_CONTINUOUSINTEGRATION_PASSWORD="${bamboo_jira_prelive_admin_password}"
ARTEMIS_CONTINUOUSINTEGRATION_TOKEN="${bamboo_ARTEMIS_CONTINUOUS_INTEGRATION_TOKEN_SECRET}"
ARTEMIS_CONTINUOUSINTEGRATION_ARTEMISAUTHENTICATIONTOKENVALUE="${bamboo_ARTEMIS_CONTINUOUS_INTEGRATION_ARTEMIS_AUTHENTICATION_TOKEN_VALUE_SECRET}"
ARTEMIS_CONTINUOUSINTEGRATION_VCSAPPLICATIONLINKNAME="Bitbucket Prelive"
ARTEMIS_CONTINUOUSINTEGRATION_EMPTYCOMMITNECESSARY="true"

ARTEMIS_APOLLON_CONVERSIONSERVICEURL="https://apollon.ase.in.tum.de/api/converter"

# Token is valid 3 days
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDS="259200"
# Token is valid 30 days
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDSFORREMEMBERME="2592000"

# Properties to be exposed on the /info management endpoint

INFO_IMPRINT="https://ase.in.tum.de/lehrstuhl_1/component/content/article/179-imprint"
INFO_TESTSERVER="true"
INFO_TEXTASSESSMENTANALYTICSENABLED="true"
INFO_STUDENTEXAMSTORESESSIONDATA="true"

LOGGING_FILE_NAME="/opt/artemis/data/artemis.log"

MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED="true"
45 changes: 1 addition & 44 deletions docker/artemis/config/cypress-postgres.env
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis configurations for Postgres setups
# Artemis configuration overrides for the Cypress E2E Postgres setups
# ----------------------------------------------------------------------------------------------------------------------

SPRING_PROFILES_ACTIVE="artemis,scheduling,jenkins,gitlab,prod,docker"

SPRING_DATASOURCE_URL="jdbc:postgresql://artemis-postgresql:5432/Artemis?sslmode=disable"
SPRING_DATASOURCE_USERNAME="postgres"
SPRING_DATASOURCE_PASSWORD=""
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE="100"

SPRING_JPA_DATABASE_PLATFORM="org.hibernate.dialect.PostgreSQL10Dialect"
SPRING_JPA_DATABASE="POSTGRESQL"
SPRING_JPA_HIBERNATE_CONNECTION_CHARSET="utf8mb4"
SPRING_JPA_HIBERNATE_CONNECTION_CHARACTERENCODING="utf8mb4"
SPRING_JPA_HIBERNATE_CONNECTION_USEUNICODE="true"

SPRING_PROMETHEUS_MONITORINGIP="131.159.89.160"

# for bamboo and bitbucket notifications on /api/programming-exercises/new-result it seems like port
# 54321 is internally open for the bamboo agents
# also can't use SSL for this as the hostnames are not integrated in the self-signed certificate
SERVER_URL="http://${HOST_HOSTNAME}:54321"

# We don't need secure passwords for testing. Lower rounds will speed up tests. 4 is the lowest
ARTEMIS_BCRYPTSALTROUNDS="4"

ARTEMIS_USERMANAGEMENT_USEEXTERNAL="false"
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_USERNAME="${bamboo_artemis_admin_username}"
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_PASSWORD="${bamboo_artemis_admin_password}"
ARTEMIS_USERMANAGEMENT_LOGIN_ACCOUNTNAME="TUM"

ARTEMIS_VERSIONCONTROL_URL="https://gitlab-test.artemis.in.tum.de"
ARTEMIS_VERSIONCONTROL_USER="${bamboo_gitlab_admin_user}"
Expand All @@ -44,26 +20,7 @@ ARTEMIS_CONTINUOUSINTEGRATION_SECRETPUSHTOKEN="${bamboo_jenkins_secret_push_toke
ARTEMIS_CONTINUOUSINTEGRATION_VCSCREDENTIALS="${bamboo_jenkins_vcs_credentials_secret}"
ARTEMIS_CONTINUOUSINTEGRATION_ARTEMISAUTHENTICATIONTOKENKEY="${bamboo_jenkins_artemis_ci_authentication_token_key_secret}"
ARTEMIS_CONTINUOUSINTEGRATION_ARTEMISAUTHENTICATIONTOKENVALUE="${bamboo_jenkins_artemis_ci_authentication_token_value_secret}"
ARTEMIS_CONTINUOUSINTEGRATION_EMPTYCOMMITNECESSARY="true"
ARTEMIS_CONTINUOUSINTEGRATION_BUILDTIMEOUT="30"

ARTEMIS_APOLLON_CONVERSIONSERVICEURL="https://apollon.ase.in.tum.de/api/converter"

# Token is valid 3 days
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDS="259200"
# Token is valid 30 days
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDSFORREMEMBERME="2592000"

# Properties to be exposed on the /info management endpoint

INFO_IMPRINT="https://ase.in.tum.de/lehrstuhl_1/component/content/article/179-imprint"
INFO_TESTSERVER="true"
INFO_TEXTASSESSMENTANALYTICSENABLED="true"
INFO_STUDENTEXAMSTORESESSIONDATA="true"

LOGGING_FILE_NAME="/opt/artemis/data/artemis.log"

MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED="true"

JENKINS_INTERNALURLS_CIURL="https://jenkins-test.artemis.in.tum.de"
JENKINS_INTERNALURLS_VCNURL="https://gitlab-test.artemis.in.tum.de"
44 changes: 44 additions & 0 deletions docker/artemis/config/cypress.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ----------------------------------------------------------------------------------------------------------------------
# Common Artemis configurations for the Cypress E2E MySQL and Postgres setups
# ----------------------------------------------------------------------------------------------------------------------

SPRING_DATASOURCE_PASSWORD=""
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE="100"

SPRING_JPA_HIBERNATE_CONNECTION_CHARSET="utf8mb4"
SPRING_JPA_HIBERNATE_CONNECTION_CHARACTERENCODING="utf8mb4"
SPRING_JPA_HIBERNATE_CONNECTION_USEUNICODE="true"

SPRING_PROMETHEUS_MONITORINGIP="131.159.89.160"

# for bamboo and bitbucket notifications on /api/programming-exercises/new-result it seems like port
# 54321 is internally open for the bamboo agents
# also can't use SSL for this as the hostnames are not integrated in the self-signed certificate
SERVER_URL="http://${HOST_HOSTNAME}:54321"

# We don't need secure passwords for testing. Lower rounds will speed up tests. 4 is the lowest
ARTEMIS_BCRYPTSALTROUNDS="4"

ARTEMIS_USERMANAGEMENT_INTERNALADMIN_USERNAME="${bamboo_artemis_admin_username}"
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_PASSWORD="${bamboo_artemis_admin_password}"
ARTEMIS_USERMANAGEMENT_LOGIN_ACCOUNTNAME="TUM"

ARTEMIS_CONTINUOUSINTEGRATION_EMPTYCOMMITNECESSARY="true"

ARTEMIS_APOLLON_CONVERSIONSERVICEURL="https://apollon.ase.in.tum.de/api/converter"

# Token is valid 3 days
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDS="259200"
# Token is valid 30 days
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDSFORREMEMBERME="2592000"

# Properties to be exposed on the /info management endpoint

INFO_IMPRINT="https://ase.in.tum.de/lehrstuhl_1/component/content/article/179-imprint"
INFO_TESTSERVER="true"
INFO_TEXTASSESSMENTANALYTICSENABLED="true"
INFO_STUDENTEXAMSTORESESSIONDATA="true"

LOGGING_FILE_NAME="/opt/artemis/data/artemis.log"

MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED="true"
11 changes: 11 additions & 0 deletions docker/artemis/config/dev.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis configurations for Dev Artemis setups
# ----------------------------------------------------------------------------------------------------------------------
# The default Artemis Spring profiles for Docker are defined here.
# ----------------------------------------------------------------------------------------------------------------------

SPRING_PROFILES_ACTIVE: artemis,scheduling,athena,dev,docker

# The following enables the Java Remote Debugging port. More infos in the documentation:
# https://docs.artemis.cit.tum.de/dev/setup.html#debugging-with-docker
_JAVA_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
9 changes: 9 additions & 0 deletions docker/artemis/config/postgres.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis configurations for Postgres setups
# ----------------------------------------------------------------------------------------------------------------------

SPRING_DATASOURCE_URL="jdbc:postgresql://artemis-postgres:5432/Artemis?sslmode=disable"
SPRING_DATASOURCE_USERNAME="postgres"

SPRING_JPA_DATABASE_PLATFORM="org.hibernate.dialect.PostgreSQL10Dialect"
SPRING_JPA_DATABASE="POSTGRESQL"
15 changes: 14 additions & 1 deletion docker/artemis/config/prod.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis configurations for Prod Artemis setups
# ----------------------------------------------------------------------------------------------------------------------
# The default Artemis Spring profiles for Docker are defined here.
# ----------------------------------------------------------------------------------------------------------------------
SPRING_PROFILES_ACTIVE="artemis,scheduling,athena,prod,docker"

# ----------------------------------------------------------------------------------------------------------------------
# Secret Overrides
# ----------------------------------------------------------------------------------------------------------------------
# Change these default secrets in another not-commited environment override file for prod systems!
# ----------------------------------------------------------------------------------------------------------------------
ARTEMIS_ATHENA_SECRET="abcdefg12345"
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_USERNAME="artemis_admin"
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_PASSWORD="artemis_admin"
Expand All @@ -17,6 +26,10 @@ SPRING_WEBSOCKET_BROKER_PASSWORD="guest"
JHIPSTER_SECURITY_AUTHENTICATION_JWT_BASE64SECRET="bXktc2VjcmV0LWtleS13aGljaC1zaG91bGQtYmUtY2hhbmdlZC1pbi1wcm9kdWN0aW9uLWFuZC1iZS1iYXNlNjQtZW5jb2RlZAo="
JHIPSTER_REGISTRY_PASSWORD="AN-ADMIN-PASSWORD-THAT-MUST-BE-CHANGED (FROM REGISTRY CONFIG)"


# ----------------------------------------------------------------------------------------------------------------------
# Plain Prod Artemis Overrides
# ----------------------------------------------------------------------------------------------------------------------
# Keep these at a minimum! Try to change the default values either in the application-docker.yml or even better
# in one of the other application.yml or application-*.yml files.
# ----------------------------------------------------------------------------------------------------------------------
ARTEMIS_USERMANAGEMENT_USEEXTERNAL="false"
1 change: 1 addition & 0 deletions docker/cypress-E2E-tests-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
mysql:
condition: service_healthy
env_file:
- ./artemis/config/cypress.env
- ./artemis/config/cypress-mysql.env

nginx:
Expand Down
16 changes: 9 additions & 7 deletions docker/cypress-E2E-tests-postgres.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# ----------------------------------------------------------------------------------------------------------------------
# Cypress Setup PostgreSQL
# Cypress Setup Postgres
# ----------------------------------------------------------------------------------------------------------------------

services:
postgresql:
postgres:
extends:
file: ./postgresql.yml
service: postgresql
file: ./postgres.yml
service: postgres

artemis-app:
extends:
file: ./artemis.yml
service: artemis-app
depends_on:
postgresql:
postgres:
condition: service_healthy
env_file:
- ./artemis/config/postgres.env
- ./artemis/config/cypress.env
- ./artemis/config/cypress-postgres.env

nginx:
Expand Down Expand Up @@ -51,7 +53,7 @@ networks:
driver: "bridge"
name: artemis
volumes:
artemis-postgresql-data:
name: artemis-postgresql-data
artemis-postgres-data:
name: artemis-postgres-data
artemis-data:
name: artemis-data
2 changes: 1 addition & 1 deletion docker/mailhog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
services:
mailhog:
container_name: artemis-mailhog
image: mailhog/mailhog
image: docker.io/mailhog/mailhog
pull_policy: always
ports:
- "1025:1025"
Expand Down
Loading