Skip to content
Permalink
Browse files

FEATURE: allow publishing docker dev either locally or net wide

Previously we had no control over how internal ports in the containter got
published.

Following UNICORN_BIND_ALL=true setting this broke docker dev env and exposed
this weakness.

The new `d/boot_dev` will only export on localhost, if you wish to export
network with use `d/boot_dev -p`
  • Loading branch information...
SamSaffron committed Nov 4, 2019
1 parent 7eb26e5 commit ff33899323f71ca750c0e555ce8f71d8896a3b3a
Showing with 10 additions and 4 deletions.
  1. +10 −4 bin/docker/boot_dev
@@ -13,11 +13,13 @@ Usage: ${0##*/} [-e VAR=VAL] [--env VAR=VAL] [--env-file filename] [-h] [--init]
-e, --env set environment variables
--env-file pass in a file containing a list of environment variable assignments
--init perform first-time initialization
-p --net-public publish ports on container on 0.0.0.0 (less secure as users on LAN may see dev env)
EOF
}

initialize=""
ENV_ARGS=""
local_publish="127.0.0.1"

while [ "${#@}" -ne "0" ]; do
case "$1" in
@@ -28,6 +30,9 @@ while [ "${#@}" -ne "0" ]; do
-i | --init)
initialize="initialize"
;;
-p | --net-public)
local_publish="0.0.0.0"
;;
-e | --env)
if [ -z "$2" ]; then
show_help
@@ -76,12 +81,13 @@ done

docker pull discourse/discourse_dev:release
docker run -d \
-p 1080:1080 \
-p 3000:3000 \
-p 9292:9292 \
-p 9405:9405 \
-p $local_publish:1080:1080 \
-p $local_publish:3000:3000 \
-p $local_publish:9292:9292 \
-p $local_publish:9405:9405 \
-v "$DATA_DIR:/shared/postgres_data:delegated" \
-v "$SOURCE_DIR:/src:delegated" \
-e UNICORN_BIND_ALL=true \
$mount_plugin_symlinks \
$ENV_ARGS \
--hostname=discourse \

2 comments on commit ff33899

@discoursebot

This comment has been minimized.

Copy link

discoursebot replied Nov 4, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/dev-recent-change-breaks-connectivity-in-docker-non-docker/132498/2

@discoursebot

This comment has been minimized.

Copy link

discoursebot replied Nov 4, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009/65

Please sign in to comment.
You can’t perform that action at this time.