-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Added generate-compose script.
- Loading branch information
1 parent
43438bf
commit 67ce848
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
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,12 @@ | ||
#! /bin/bash | ||
|
||
# Mandatory settings | ||
SETTING_EXTERNAL_HOST='localhost.localdomain' | ||
SETTING_ZULIP_ADMINISTRATOR='[email protected]' | ||
|
||
# Optional secrets config | ||
POSTGRES_PASSWORD='REPLACE_WITH_SECURE_POSTGRES_PASSWORD' | ||
MEMCACHED_PASSWORD='REPLACE_WITH_SECURE_MEMCACHED_PASSWORD' | ||
RABBITMQ_DEFAULT_PASS='REPLACE_WITH_SECURE_RABBITMQ_PASSWORD' | ||
REDIS_PASSWORD='REPLACE_WITH_SECURE_REDIS_PASSWORD' | ||
SECRETS_secret_key='REPLACE_WITH_SECURE_SECRET_KEY' |
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 |
---|---|---|
|
@@ -76,8 +76,8 @@ services: | |
SECRETS_memcached_password: 'REPLACE_WITH_SECURE_MEMCACHED_PASSWORD' | ||
SECRETS_redis_password: 'REPLACE_WITH_SECURE_REDIS_PASSWORD' | ||
SECRETS_secret_key: 'REPLACE_WITH_SECURE_SECRET_KEY' | ||
SETTING_EXTERNAL_HOST: 'localhost.localdomain' | ||
SETTING_ZULIP_ADMINISTRATOR: '[email protected]' | ||
SETTING_EXTERNAL_HOST: 'REPLACE_WITH_EXTERNAL_HOST' | ||
SETTING_ZULIP_ADMINISTRATOR: 'REPLACE_WITH_ADMIN_EMAIL' | ||
SETTING_EMAIL_HOST: '' # e.g. smtp.example.com | ||
SETTING_EMAIL_HOST_USER: '[email protected]' | ||
SETTING_EMAIL_PORT: '587' | ||
|
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,45 @@ | ||
#! /bin/bash | ||
source .config | ||
|
||
compose=`cat ./docker-compose.yml.in` | ||
|
||
compose="${compose//REPLACE_WITH_EXTERNAL_HOST/$SETTING_EXTERNAL_HOST}"; | ||
compose="${compose//REPLACE_WITH_ADMIN_EMAIL/$SETTING_ZULIP_ADMINISTRATOR}"; | ||
|
||
if [ $POSTGRES_PASSWORD == "REPLACE_WITH_SECURE_POSTGRES_PASSWORD" ]; | ||
then | ||
compose="${compose//REPLACE_WITH_SECURE_POSTGRES_PASSWORD/$(tr -dc 'abcdef1234567890' </dev/urandom | head -c 32 ; echo)}"; | ||
else | ||
compose="${compose//REPLACE_WITH_SECURE_POSTGRES_PASSWORD/$POSTGRES_PASSWORD}"; | ||
fi; | ||
|
||
if [ $MEMCACHED_PASSWORD == "REPLACE_WITH_SECURE_MEMCACHED_PASSWORD" ]; | ||
then | ||
compose="${compose//REPLACE_WITH_SECURE_MEMCACHED_PASSWORD/$(tr -dc 'abcdef1234567890' </dev/urandom | head -c 32 ; echo)}"; | ||
else | ||
compose="${compose//REPLACE_WITH_SECURE_MEMCACHED_PASSWORD/$MEMCACHED_PASSWORD}"; | ||
fi; | ||
|
||
if [ $RABBITMQ_DEFAULT_PASS == "REPLACE_WITH_SECURE_RABBITMQ_PASSWORD" ]; | ||
then | ||
compose="${compose//REPLACE_WITH_SECURE_RABBITMQ_PASSWORD/$(tr -dc 'abcdef1234567890' </dev/urandom | head -c 32 ; echo)}"; | ||
else | ||
compose="${compose//REPLACE_WITH_SECURE_RABBITMQ_PASSWORD/$RABBITMQ_DEFAULT_PASS}"; | ||
fi; | ||
|
||
if [ $REDIS_PASSWORD == "REPLACE_WITH_SECURE_REDIS_PASSWORD" ]; | ||
then | ||
compose="${compose//REPLACE_WITH_SECURE_REDIS_PASSWORD/$(tr -dc 'abcdef1234567890' </dev/urandom | head -c 32 ; echo)}"; | ||
else | ||
compose="${compose//REPLACE_WITH_SECURE_REDIS_PASSWORD/$REDIS_PASSWORD}"; | ||
fi; | ||
|
||
if [ $SECRETS_secret_key == "REPLACE_WITH_SECURE_SECRET_KEY" ]; | ||
then | ||
compose="${compose//REPLACE_WITH_SECURE_SECRET_KEY/$(tr -dc 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' </dev/urandom | head -c 64 ; echo)}"; | ||
else | ||
compose="${compose//REPLACE_WITH_SECURE_SECRET_KEY/$SECRETS_secret_key}"; | ||
fi; | ||
|
||
|
||
echo "$compose" > "docker-compose.yml" |