Permalink
Browse files

added ssl support in docker-compose.yml

  • Loading branch information...
eiabea committed Apr 11, 2016
1 parent 2218617 commit 953712205a6caae99db0ec54f0079bbd8e71ac01
Showing with 40 additions and 6 deletions.
  1. +4 −1 .gitignore
  2. +2 −1 Dockerfile
  3. +6 −2 docker-compose.yml
  4. +28 −2 docker-entrypoint.sh
View
@@ -61,4 +61,7 @@ target/
_trial_temp/
# Docker data
data/
data/
# SSL
ssl/
View
@@ -38,6 +38,7 @@ RUN adduser --disabled-password --gecos \"\" openbazaar
RUN chown -R openbazaar:openbazaar /OpenBazaar-Server
VOLUME /root/.openbazaar
VOLUME /ssl
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "openbazaard.py", "start"]
CMD ["python", "openbazaard.py", "start"]
View
@@ -11,7 +11,11 @@ services:
- "18470:18470"
volumes:
- "./data:/root/.openbazaar"
- "./ssl:/ssl"
environment:
# Should be changed to more secure values
- "USERNAME=username"
- "PASSWORD=password"
- "OB_USERNAME=username"
- "OB_PASSWORD=password"
- "OB_SSL=false"
- "OB_SSL_CERT=/ssl/server.crt"
- "OB_SSL_KEY=/ssl/server.key"
View
@@ -12,11 +12,37 @@ set_password() {
sed -ri "s/^#?(PASSWORD\s*=\s*)\S+/\1$sedEscapedValue/" "/OpenBazaar-Server/ob.cfg"
}
set_ssl() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(SSL\s*=\s*)\S+/\1$sedEscapedValue/" "/OpenBazaar-Server/ob.cfg"
}
set_ssl_cert() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(SSL_CERT\s*=\s*)\S+/\1$sedEscapedValue/" "/OpenBazaar-Server/ob.cfg"
}
set_ssl_key() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(SSL_KEY\s*=\s*)\S+/\1$sedEscapedValue/" "/OpenBazaar-Server/ob.cfg"
}
echo "Setting username"
set_username $USERNAME
set_username $OB_USERNAME
echo "Setting password"
set_password $PASSWORD
set_password $OB_PASSWORD
if [ "$OB_SSL" = true ] ; then
echo "Setting up SSL"
set_ssl "True"
echo "Setting SSL cert location"
set_ssl_cert $OB_SSL_CERT
echo "Setting SSL key location"
set_ssl_key $OB_SSL_KEY
fi
echo "Executing ${@}"
exec "$@"

0 comments on commit 9537122

Please sign in to comment.