Skip to content

Conversation

@Smeds
Copy link

@Smeds Smeds commented Oct 9, 2017

New version of previous remove pull-request

This pull request will make it possible to use docker secrets to mask user credentials when a container is created. To use the feature, just append "_FILE" to the regular environment variables and assign it the path where the secret is stored. It's a nice feature to have when using ansible-containers, since you then can use ansible vault to store credentials.

Follow the steps below to build stackstorm with docker secrets. I haven't changed the mongo credentials since I wasn't able to successfully change them using current docker compose file.

Howto use docker secrets

Step1: Create credentials

mkdir secrets
echo "rabbitmq" > secrets/rabbitmq_user.txt
echo "rabbitmq_pass" > secrets/rabbitmq_password.txt
echo "postgres" > secrets/postgres_user.txt
echo "postgres_pass" > secrets/postgres_password.txt
echo "redis_pass" > secrets/redis_password.txt
echo "st2admin" > secrets/stackstorm_user.txt
echo "stackstorm_password" > secrets/stackstorm_password.txt

Step2: Export variables

export RABBITMQ_DEFAULT_USER_FILE=/run/secrets/rabbitmq_secret_user
export RABBITMQ_DEFAULT_PASS_FILE=/run/secrets/rabbitmq_secret_pass
export POSTGRES_USER_FILE=/run/secrets/postgres_secret_user
export POSTGRES_PASSWORD_FILE=/run/secrets/postgres_secret_pass
export REDIS_PASSWORD_FILE=/run/secrets/redis_secret_pass
export ST2_USER_FILE=/run/secrets/stackstorm_secret_user
export ST2_PASSWORD_FILE=/run/secrets/stackstorm_secret_pass

Step3: Create env variables

make env

Step4: Build docker image

You need to build the image using the dockerfile found in this commit.

cd images/stackstorm
docker build . --tag stackstorm/stackstorm:latest

Step5: Run docker-compose

docker-compose -f docker-compose-with-secrets.yml up -d

Enter container and test stackstorm

docker exec -it stackstorm /bin/bash
st2ctl restart
st2 action list

@emptywee
Copy link

That (seems like) will break https://github.com/StackStorm/st2-docker/tree/master/runtime/kubernetes-1ppc stuff which is based heavily on env variables to setup components in the containers and will require most of the configuration part to be re-written.

@Smeds
Copy link
Author

Smeds commented Dec 4, 2017

I will see if I can get access to a kubernetes environment to make the necessary updates for it to not break stuff

@dzimine
Copy link

dzimine commented Jan 31, 2018

Hi @Smeds
do you foresee any cycles on completing this?
Thanks much!

@Smeds
Copy link
Author

Smeds commented Feb 8, 2018

Hi @dzimine

At the moment I haven't access to a kubernetes environment, which makes a bit hard for me to develop and test a solution right now. But we are planing of setting up one in the future, maybe within 6-12 month.

@arm4b arm4b closed this in 6cc70fd Jul 17, 2020
transhapHigsn pushed a commit to DiligenceVault/st2-docker that referenced this pull request Jun 8, 2021
You can find the old deprecated version in `DEPRECATED/all-in-one` branch archive: https://github.com/StackStorm/st2-docker/tree/DEPRECATED/all-in-one

Closes StackStorm#22, closes StackStorm#23, closes StackStorm#26, closes StackStorm#29, closes StackStorm#34, closes StackStorm#41, closes StackStorm#43, closes StackStorm#92, closes StackStorm#112, closes StackStorm#117, closes StackStorm#125, closes StackStorm#133, closes StackStorm#141, closes StackStorm#145, closes StackStorm#151, closes StackStorm#163, closes StackStorm#187,
closes StackStorm#188, closes StackStorm#189, closes StackStorm#190
Closes StackStorm#162, closes StackStorm#138, closes StackStorm#108, closes StackStorm#102, closes StackStorm#65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants