From 8027a98f72d2d30161c0a193ceef467c05e629df Mon Sep 17 00:00:00 2001 From: Anton Sannikov Date: Mon, 20 May 2019 22:36:08 +0200 Subject: [PATCH 1/3] Confluence config added --- docker-compose.yml | 20 +++++++++ env-example | 8 ++++ .../docker-entrypoint-initdb.d/.gitignore | 1 + .../init_confluence_db.sh | 44 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 postgres/docker-entrypoint-initdb.d/init_confluence_db.sh diff --git a/docker-compose.yml b/docker-compose.yml index 52f0cf31..b022bbd4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,6 +41,8 @@ volumes: driver: ${VOLUMES_DRIVER} mosquitto: driver: ${VOLUMES_DRIVER} + confluence: + driver: ${VOLUMES_DRIVER} sonarqube: driver: ${VOLUMES_DRIVER} @@ -414,6 +416,10 @@ services: - SONARQUBE_POSTGRES_DB=${SONARQUBE_POSTGRES_DB} - SONARQUBE_POSTGRES_USER=${SONARQUBE_POSTGRES_USER} - SONARQUBE_POSTGRES_PASSWORD=${SONARQUBE_POSTGRES_PASSWORD} + - POSTGRES_CONFLUENCE_INIT=${CONFLUENCE_POSTGRES_INIT} + - POSTGRES_CONFLUENCE_DB=${CONFLUENCE_POSTGRES_DB} + - POSTGRES_CONFLUENCE_USER=${CONFLUENCE_POSTGRES_USER} + - POSTGRES_CONFLUENCE_PASSWORD=${CONFLUENCE_POSTGRES_PASSWORD} networks: - backend @@ -1459,3 +1465,17 @@ services: networks: - backend - frontend +### CONFLUENCE ################################################ + confluence: + container_name: Confluence + image: atlassian/confluence-server:${CONFLUENCE_VERSION} + restart: always + ports: + - "${CONFLUENCE_HOST_HTTP_PORT}:8090" + networks: + - frontend + - backend + depends_on: + - postgres + volumes: + - ${DATA_PATH_HOST}/Confluence:/var/atlassian/application-data \ No newline at end of file diff --git a/env-example b/env-example index b5986c19..9ba3cdda 100644 --- a/env-example +++ b/env-example @@ -366,6 +366,14 @@ JENKINS_HOST_HTTP_PORT=8090 JENKINS_HOST_SLAVE_AGENT_PORT=50000 JENKINS_HOME=./jenkins/jenkins_home +### CONFLUENCE ############################################### +CONFLUENCE_POSTGRES_INIT=true +CONFLUENCE_VERSION=6.13-ubuntu-18.04-adoptopenjdk8 +CONFLUENCE_POSTGRES_DB=laradock_confluence +CONFLUENCE_POSTGRES_USER=laradock_confluence +CONFLUENCE_POSTGRES_PASSWORD=laradock_confluence +CONFLUENCE_HOST_HTTP_PORT=8090 + ### GRAFANA ############################################### GRAFANA_PORT=3000 diff --git a/postgres/docker-entrypoint-initdb.d/.gitignore b/postgres/docker-entrypoint-initdb.d/.gitignore index 0721338b..a56b450c 100644 --- a/postgres/docker-entrypoint-initdb.d/.gitignore +++ b/postgres/docker-entrypoint-initdb.d/.gitignore @@ -2,3 +2,4 @@ !init_gitlab_db.sh !init_jupyterhub_db.sh !init_sonarqube_db.sh +!init_confluence_db.sh \ No newline at end of file diff --git a/postgres/docker-entrypoint-initdb.d/init_confluence_db.sh b/postgres/docker-entrypoint-initdb.d/init_confluence_db.sh new file mode 100644 index 00000000..ce5e9f72 --- /dev/null +++ b/postgres/docker-entrypoint-initdb.d/init_confluence_db.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Copy createdb.sh.example to createdb.sh +# then uncomment then set database name and username to create you need databases +# +# example: .env POSTGRES_USER=appuser and need db name is myshop_db +# +# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL +# CREATE USER myuser WITH PASSWORD 'mypassword'; +# CREATE DATABASE myshop_db; +# GRANT ALL PRIVILEGES ON DATABASE myshop_db TO myuser; +# EOSQL +# +# this sh script will auto run when the postgres container starts and the $DATA_PATH_HOST/postgres not found. +# +# +# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL +# CREATE USER db1 WITH PASSWORD 'db1'; +# CREATE DATABASE db1; +# GRANT ALL PRIVILEGES ON DATABASE db1 TO db1; +# EOSQL +# +# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL +# CREATE USER db2 WITH PASSWORD 'db2'; +# CREATE DATABASE db2; +# GRANT ALL PRIVILEGES ON DATABASE db2 TO db2; +# EOSQL +# +# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL +# CREATE USER db3 WITH PASSWORD 'db3'; +# CREATE DATABASE db3; +# GRANT ALL PRIVILEGES ON DATABASE db3 TO db3; +# EOSQL +# +### default database and user for confluence ############################################## +if [ "$POSTGRES_CONFLUENCE_INIT" == 'true' ]; then + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL + CREATE USER $POSTGRES_CONFLUENCE_USER WITH PASSWORD '$POSTGRES_CONFLUENCE_PASSWORD'; + CREATE DATABASE $POSTGRES_CONFLUENCE_DB; + GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_CONFLUENCE_DB TO $POSTGRES_CONFLUENCE_USER; + ALTER ROLE $POSTGRES_CONFLUENCE_USER CREATEROLE SUPERUSER; + EOSQL + echo +fi \ No newline at end of file From f23149115d7f8c8ecfe18f82b62f57f02d4d56bc Mon Sep 17 00:00:00 2001 From: Anton Sannikov Date: Mon, 20 May 2019 22:51:36 +0200 Subject: [PATCH 2/3] Confluence docs added --- DOCUMENTATION/content/documentation/index.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index 0704aba4..22aa559c 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -1023,8 +1023,21 @@ _Note: You can customize the port on which beanstalkd console is listening by ch +
+ +## Use Confluence +1 - Run the Confluence Container (`confluence`) with the `docker-compose up` command. Example: +```bash +docker-compose up -d confluence +``` + +2 - Open your browser and visit the localhost on port **8090**: `http://localhost:8090` + +**Note:** You can you trial version and then you have to buy a licence to use it. + +You can set custom confluence version in `CONFLUENCE_VERSION`. [Find more info in section 'Versioning'](https://hub.docker.com/r/atlassian/confluence-server/)
From 7ad82a3cd1f864d21de73b513f24760b5c96a4de Mon Sep 17 00:00:00 2001 From: Anton Sannikov Date: Thu, 31 Oct 2019 11:50:39 +0300 Subject: [PATCH 3/3] Added nginx settings for confluence --- DOCUMENTATION/content/documentation/index.md | 10 +++++ nginx/sites/confluence.conf.example | 43 ++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 nginx/sites/confluence.conf.example diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index d2b91fb4..14d9e331 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -1044,6 +1044,7 @@ _Note: You can customize the port on which beanstalkd console is listening by ch
+ ## Use Confluence 1 - Run the Confluence Container (`confluence`) with the `docker-compose up` command. Example: @@ -1058,6 +1059,15 @@ docker-compose up -d confluence You can set custom confluence version in `CONFLUENCE_VERSION`. [Find more info in section 'Versioning'](https://hub.docker.com/r/atlassian/confluence-server/) + +##### Confluence usage with Nginx and SSL. + +1. Find an instance configuration file in `nginx/sites/confluence.conf.example` and replace sample domain with yours. + +2. Configure ssl keys to your domain. + +Keep in mind that Confluence is still accessible on 8090 anyway. +
## Use ElasticSearch diff --git a/nginx/sites/confluence.conf.example b/nginx/sites/confluence.conf.example new file mode 100644 index 00000000..f804956b --- /dev/null +++ b/nginx/sites/confluence.conf.example @@ -0,0 +1,43 @@ +server { + listen 80; + listen [::]:80; + server_name www.confluence-domain.com; + rewrite ^(.*) https://confluence-domain.com$1/ permanent; +} + +server { + listen 80; + listen [::]:80; + server_name confluence-domain.com; + rewrite ^(.*) https://confluence-domain.com/ permanent; +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + ssl_certificate /etc/nginx/ssl/confluence-domain.com.crt; + ssl_certificate_key /etc/nginx/ssl/confluence-domain.com.key; + + server_name confluence-domain.com; + + location / { + client_max_body_size 100m; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://confluence-domain.com:8090/; + } + + location /synchrony { + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://confluence-domain.com:8090/synchrony-proxy; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + } + + error_log /var/log/nginx/bookchangerru_error.log; + access_log /var/log/nginx/bookchangerru_access.log; +}