Skip to content

Commit

Permalink
reorganize the docker stacks a bit, with some comments on how to use
Browse files Browse the repository at this point in the history
  • Loading branch information
Bdegraaf1234 committed Nov 27, 2023
1 parent ec84e0a commit ede8780
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 73 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,27 +204,17 @@ jobs:
org.opencontainers.image.licenses=Apache-2.0
- name: Trigger downstream repo (appserver)
# if: github.event_name != 'pull_request' #only after a merge
if: github.event_name != 'pull_request' #only after a merge
uses: convictional/[email protected]
with:
owner: yatharthranjan
owner: RADAR-base
repo: RADAR-Appserver
github_token: ${{ secrets.APPSERVER_REPO_PERSONAL_ACCESS_TOKEN }} #token with repo access to app_server
workflow_file_name: downstream.yml
ref: downstream_e2e_testing
workflow_file_name: main.yml
ref: master #change for testing against a specific downstream branch
propagate_failure: false
wait_workflow: false

# # placeholder for testing
# - name: End to end tests (docker image)
# id: e2e-prod-docker
# run: |
# cp src/test/resources/config/keystore.p12 src/main/docker/etc/config
# ./gradlew -Pprod buildDocker -x test -x javadocJar
# docker-compose -f src/main/docker/app.yml up -d
# yarn run e2e-prod
# docker-compose -f src/main/docker/app.yml down -v

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#this dockerfile is used in the github actions workflows

# Build stage
FROM --platform=$BUILDPLATFORM eclipse-temurin:17-jdk as builder

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ docker-compose files.
```shell
keytool -genkeypair -alias radarbase-managementportal-ec -keyalg EC -validity 3650 -keysize 256 -sigalg SHA256withECDSA -storetype PKCS12 -keystore src/main/docker/etc/config/keystore.p12 -storepass radarbase -keypass radarbase
```
3. Now, we can start the stack with `docker-compose -f src/main/docker/management-portal.yml up -d`.
3. Now, we can start the stack with `docker-compose -f src/main/docker/mp_dockerhub/docker-compose.yml up -d`.

This will start a Postgres database and ManagementPortal. The default password for the `admin`
account is `admin`. An angular live development server to access the managementportal can be started using the `yarn start` command (see [Development](#development)).
Expand Down Expand Up @@ -78,8 +78,6 @@ memory database and ManagementPortal. An angular live development server to acce
| Demo data loaded | Yes | No |




The docker image can be pulled by running `docker pull radarbase/management-portal:latest`.

## Configuration
Expand Down Expand Up @@ -276,6 +274,7 @@ will generate few files:
To optimize the ManagementPortal application for production, run:
./gradlew -Pprod clean bootWar
### Hosting in production
The latest Meta-QR code implementation requires REST resources on `api/meta-token/*` should definitely be rate-limited by upstream servers.
Expand Down Expand Up @@ -331,7 +330,7 @@ To achieve this, first build a docker image of your app by running:
Then run:
docker-compose -f src/main/docker/app.yml up -d
docker-compose -f src/main/docker/mp_local/docker-compose.yml up -d
For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`yo jhipster:docker-compose`), which is able to generate docker configurations for one or several JHipster applications.
## Documentation
Expand Down
21 changes: 0 additions & 21 deletions src/main/docker/app.yml

This file was deleted.

30 changes: 13 additions & 17 deletions src/main/docker/management-portal.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
version: '2'
services:
managementportal-app:
image: radarbase/management-portal
environment:
- SPRING_PROFILES_ACTIVE=prod,api-docs
- SPRING_DATASOURCE_URL=jdbc:postgresql://managementportal-postgresql:5432/managementportal
- SPRING_DATASOURCE_USERNAME=radarbase
- SPRING_DATASOURCE_PASSWORD=radarbase
- MANAGEMENTPORTAL_FRONTEND_CLIENT_SECRET=secret
- JHIPSTER_SLEEP=10 # gives time for the database to boot before the application
- JAVA_OPTS=-Xmx512m # maximum heap size for the JVM running ManagementPortal, increase this as necessary
ports:
- 8080:8080
volumes:
- ./etc:/mp-includes
managementportal-postgresql:
extends:
file: postgresql.yml
service: managementportal-postgresql
image: radarbase/management-portal
environment:
- SPRING_PROFILES_ACTIVE=prod,api-docs
- SPRING_DATASOURCE_URL=jdbc:postgresql://managementportal-postgresql:5432/managementportal
- SPRING_DATASOURCE_USERNAME=radarbase
- SPRING_DATASOURCE_PASSWORD=radarbase
- MANAGEMENTPORTAL_FRONTEND_CLIENT_SECRET=secret
- JHIPSTER_SLEEP=10 # gives time for the database to boot before the application
- JAVA_OPTS=-Xmx512m # maximum heap size for the JVM running ManagementPortal, increase this as necessary
ports:
- "8080:8080"
volumes:
- ./etc:/mp-includes
25 changes: 25 additions & 0 deletions src/main/docker/mp_dockerhub/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Docker stack to run managementport using only dockerhub images

version: '2.1'

networks:
mail:
driver: bridge
internal: true

services:
managementportal-app:
extends:
file: ../management-portal.yml
service: managementportal-app

managementportal-postgresql:
extends:
file: ../postgresql.yml
service: postgresql

## smtp server, uncomment if needed
# managementportal-smtp:
# extends:
# file: ../smtp.yml
# service: smtp
17 changes: 17 additions & 0 deletions src/main/docker/mp_local/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Docker stack to run managementport using a locally built docker image built using the command
# ./gradlew bootWar -Pprod buildDocker

version: '2'
services:
managementportal-app:
extends:
file: ../management-portal.yml
service: managementportal-app
image: managementportal
environment:
- SPRING_LIQUIBASE_CONTEXTS=dev #includes testing_data, remove for production builds

managementportal-postgresql:
extends:
file: ../postgresql.yml
service: postgresql
4 changes: 2 additions & 2 deletions src/main/docker/mysql.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '2'
services:
managementportal-mysql:
mysql:
image: mysql:5.7.13
# volumes:
# - ~/volumes/jhipster/ManagementPortal/mysql/:/var/lib/mysql/
Expand All @@ -9,5 +9,5 @@ services:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=managementportal
ports:
- 3306:3306
- "3306:3306"
command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8
15 changes: 15 additions & 0 deletions src/main/docker/non_mp/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Docker stack containing all the "required" interacting components to run managementportal
# Intended to use alongside local executables of managementportal (e.g. in an Intellij) for development/debug purposes

version: '2'
services:
managementportal-postgresql:
extends:
file: ../postgresql.yml
service: managementportal-postgresql

## smtp server, uncomment if needed
# managementportal-smtp:
# extends:
# file: ../smtp.yml
# service: smtp
4 changes: 2 additions & 2 deletions src/main/docker/postgresql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: '2'
services:
managementportal-postgresql:
postgresql:
image: postgres:11-alpine
environment:
- POSTGRES_USER=radarbase
- POSTGRES_PASSWORD=radarbase
- POSTGRES_DB=managementportal
ports:
- 5432:5432
- "5432:5432"
12 changes: 2 additions & 10 deletions src/main/docker/docker-compose.yml → src/main/docker/smtp.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
version: '2.1'

networks:
mail:
driver: bridge
internal: true


version: '2'
services:
smtp:
image: namshi/smtp:latest
Expand All @@ -16,4 +8,4 @@ services:
- /var/spool/exim
restart: always
env_file:
- ./etc/smtp.env
- ./etc/smtp.env # generate by filling in ./etc/smpt.env.template
6 changes: 3 additions & 3 deletions src/main/docker/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
managementportal-sonar:
sonar:
image: sonarqube:6.2-alpine
ports:
- 9000:9000
- 9092:9092
- "9000:9000"
- "9092:9092"

0 comments on commit ede8780

Please sign in to comment.