-
Notifications
You must be signed in to change notification settings - Fork 4
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
26 review and improve docker compose scripts #53
Merged
+613
−193
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
394c624
#26 add nginx, rename .env to .env.template
panositi b38a663
#26 expose restart.on.boot as an env parameter
panositi 8b98f52
Merge branch 'dev' into 26-review-and-improve-docker-compose-scripts
panositi b028193
#26 change CI and test workflow
panositi c87db28
#26 add provisioning scripts
panositi cb22c47
#26 adjust defautl parameters and edit README
panositi 656cbf4
#26 fix README typo
panositi 33242c3
#26 revoke application.properties change, an provisioning/ssm
panositi 04b6299
Adds more info on ports (#26)
scp93ch 41f711c
#26 remove kc healthcheck.sh, .env.template from docker.compose.test
panositi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Variables set in here are picked up by docker-compose automatically | ||
|
||
# Service ports on host | ||
#TOMCAT_PORT=8081 | ||
#NODEJS_PORT=3000 | ||
#JAVADEBUG_PORT=5005 | ||
#KEYCLOAK_PORT=8080 | ||
|
||
# Linux developers should uncomment this line: | ||
#DOCKER_GATEWAY_HOST=172.17.0.1 | ||
|
||
# SERVICE_PROTOCOL is the protocol used to access the service from the client: | ||
# "http" or "https" | ||
#SERVICE_PROTOCOL=http | ||
|
||
# SERVICE_PORT is the port used by the client to access the service. If the | ||
# client is accessing the embedded reverse proxy directly then this should be | ||
# the same as the PROXY_EXTERNAL_PORT. If the client is going via another | ||
# reverse proxy then this should be the port that proxy listens on (e.g. 443). | ||
#SERVICE_PORT=8089 | ||
|
||
# PROXY_EXTERNAL_PORT is the port that the reverse proxy is going to listen on. | ||
# If there are multiple deployments on the same machine then they all need | ||
# different PROXY_EXTERNAL_PORT settings. | ||
#PROXY_EXTERNAL_PORT=8089 | ||
|
||
# Location of the Spyderisk System Modeller documentation to be used in the web application: | ||
#DOCUMENTATION_URL=https://spyderisk.org/documentation/modeller/latest/ | ||
|
||
# Secret shared for communication between Spyderisk and Keycloak services | ||
# The docker-compose.yaml file demonstrates how to insert the value into the Keycloak configuration | ||
#KEYCLOAK_CREDENTIALS_SECRET=DfkQBcVpjbO6gTMXMBUBfHe45UmFhGxk | ||
|
||
# Keycloak admin account credentials | ||
#KEYCLOAK_ADMIN_USERNAME=admin | ||
#KEYCLOAK_ADMIN_PASSWORD=password | ||
|
||
# Spring boot application property reset.on.start, default value is true | ||
#RESET_ON_START=false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY, without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, except where | ||
# stated in the Licence Agreement supplied with the software. | ||
# | ||
# Received by Panos Melas, University of Southampton IT Innovation Centre, in | ||
# good faith on 28/04/2023 from | ||
# https://stackoverflow.com/questions/53301299/add-healthcheck-in-keycloak-docker-swarm-service | ||
|
||
# This is a workaround script for the missing cURL command not included in | ||
# newer keycloak docker images. The script checks the health status of the | ||
# keycloak service at http://localhost:8080/auth/health/ready | ||
# { | ||
# "status": "UP", | ||
# "checks": [ | ||
# ] | ||
# } | ||
# | ||
|
||
exec 3<>/dev/tcp/localhost/8080 | ||
|
||
echo -e "GET /auth/health/ready HTTP/1.1\nhost: localhost:8080\n" >&3 | ||
|
||
timeout --preserve-status 1 cat <&3 | grep -m 1 '"status":\s\+"UP"' | ||
ERROR=$? | ||
|
||
exec 3<&- | ||
exec 3>&- | ||
|
||
exit $ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nginx.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
# This script is a replacement for the standard entrypoint script used in the | ||
# nginx image. It expects that there is a directory from the host mounted at | ||
# `/tmp/import` containing the `nginx.conf.template` file. It expects that the | ||
# `SERVICE_PROTOCOL` and `SERVICE_PORT` environment variables are set in the | ||
# `.env` file. | ||
|
||
# The `endsubst` replaces `scheme` and `server_port` variables and copies | ||
# `nginx.conf.template` to `nginx.conf` Then the `nginx` command is run the | ||
# nginx service. | ||
|
||
envsubst '$${scheme} $${server_port} $${kc_proxy_pass} $${documentation_url} $${tomcat_port}' < \ | ||
/tmp/import/nginx.conf.template > /etc/nginx/nginx.conf | ||
|
||
nginx -g 'daemon off;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
|
||
user nginx; | ||
worker_processes auto; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_host"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
|
||
# This first line sets the HTTP Host header in the request to the one that was received by nginx (preserving it). | ||
# It includes the request port and is essential for the SSM to redirect the browser to the correct Keycloak address. | ||
proxy_set_header Host $http_host; | ||
# These two are used by keycloak if it is set to proxy address forwarding mode: | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; # If this proxy is behind another reverse proxy that terminates SSL then $scheme must be explicitly set to "https" | ||
# These headers do not seem to have any effect but can't hurt and may be used in logging. | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-Host $server_name; | ||
proxy_set_header X-Forwarded-Port $server_port; | ||
|
||
server { | ||
listen 80; | ||
absolute_redirect off; | ||
|
||
# For each endpoint, we are explicit about how to treat URLs without a trailing slash. Not doing this causes some hidden problems. | ||
# $scheme and $http_host come from the request URL and are e.g. "https" and "some.domain:port". They are needed to preserve this part of the URL. | ||
|
||
location / { | ||
return 301 $scheme://$http_host/system-modeller/; | ||
} | ||
location = /system-modeller { | ||
rewrite ^(.*)$ $scheme://$http_host$1/ redirect; | ||
} | ||
location /system-modeller/ { | ||
client_max_body_size 100M; | ||
#proxy_pass http://ssm:8080/system-modeller/; | ||
proxy_pass http://ssm:$tomcat_port/system-modeller/; | ||
} | ||
|
||
location = /auth { | ||
rewrite ^(.*)$ $scheme://$http_host$1/ redirect; | ||
} | ||
location /auth/ { | ||
proxy_pass $kc_proxy_pass/; | ||
} | ||
|
||
location = /documentation { | ||
rewrite ^(.*)$ $scheme://$http_host$1/ redirect; | ||
} | ||
location /documentation/ { | ||
rewrite ^/documentation/(.*) $documentation_url$1 redirect; | ||
} | ||
|
||
location /documentation/redirect/ { | ||
# Here we do a browser redirect of the URL for things starting /documentation/redirect | ||
# These are special addresses embedded in the SSM where we want to decouple the documentation identifier in the SSM | ||
# from the actual place in the documentation that should be accessed. | ||
# Right now, all locations defined in the SSM need to redirect to a heading in the Reference Guide so this is easy. | ||
rewrite ^/documentation/redirect/(.*) $documentation_url/Reference%20Guide/#$1 redirect; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
# This script is a replacement for the standard entrypoint script used in the | ||
# catalina image. It expects that there is a directory from the host mounted at | ||
# `/tmp/startup` containing the `entrypoint.sh` file. | ||
# | ||
|
||
#https://github-registry-files.githubusercontent.com/619830179/a8341180-decd-11ed-8428-25c0158a373b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230530%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230530T140817Z&X-Amz-Expires=300&X-Amz-Signature=66ef5deb95184f3eda6b0c13f1043a870403d62964b39f10363512bc6201d640&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=619830179&response-content-disposition=filename%3Ddomain-network-6a3-1-1.zip&response-content-type=application%2Foctet-stream | ||
|
||
wget https://github.com/SPYDERISK/domain-network/packages/1826148 -O /tmp/knowledgebases/domain-network.zip | ||
|
||
echo "entrypoint: starting up catalina" | ||
/var/lib/tomcat/bin/catalina.sh run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line change is not require, please revert it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
provisioning/ssm
and revoke application.properties change