File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,10 +77,6 @@ case "$1" in
7777 port=$( docker port $id 5000 | sed ' s/0.0.0.0://' )
7878 echo " http://$( < " $DOKKU_ROOT /HOSTNAME" ) :$port " > " $DOKKU_ROOT /$APP /URL"
7979
80- # start the worker
81- DOCKER_ARGS=" $( : | pluginhook docker-args " $APP " worker) "
82- docker run -d --name=" $APP_WORKER_NAME " $DOCKER_ARGS " $IMAGE_GENERIC :latest" /bin/bash -c " /start worker" > /dev/null
83-
8480 # finish deployment
8581 pluginhook post-deploy " $APP " " $port "
8682
@@ -115,7 +111,9 @@ case "$1" in
115111 deploy:all)
116112 for app in $( ls -d $DOKKU_ROOT /* /) ; do
117113 APP=" $( basename $app ) "
118- dokku deploy " $APP "
114+ if [[ -f " $app /refs/heads/master" ]]; then
115+ dokku deploy " $APP "
116+ fi
119117 done
120118 ;;
121119
Original file line number Diff line number Diff line change @@ -18,11 +18,6 @@ case "$2" in
1818 print_args " DOCKER_ARGS_WEB"
1919 ;;
2020
21- worker)
22- print_args " DOCKER_ARGS"
23- print_args " DOCKER_ARGS_WORKER"
24- ;;
25-
2621 run)
2722 print_args " DOCKER_ARGS"
2823 ;;
Original file line number Diff line number Diff line change @@ -17,12 +17,6 @@ if [[ ! -f "$DB_ADMIN_PASSWORD" ]]; then
1717fi
1818
1919stop_and_remove_container " $DB_CONTAINER "
20-
21- docker run --detach " --publish=$DB_PORT " \
22- --volume=" $DB_VOLUME " :" $DB_CONTAINER_VOLUME " \
23- --volume=" $DB_ADMIN_PASSWORD " :" $DB_CONTAINER_PASSWORD " \
24- --name=" $DB_CONTAINER " \
25- " $DB_IMAGE " \
26- /usr/bin/start_mariadb.sh > /dev/null
20+ ensure_database_container_is_running
2721
2822cat
Original file line number Diff line number Diff line change @@ -13,6 +13,6 @@ if [[ -d "$DB_LINKS" ]] && [[ -f "$DB_APP_PASSWORD" ]] && [[ $(ls -1 "$DB_LINKS"
1313 docker run -i -a stdin " $IMAGE " /bin/bash -c " cat > /app/.profile.d/mariadb_env" << EOF | commit_image "$IMAGE "
1414[ "\$ MARIADB_NAME" != "" ] && export DATABASE_URL=mysql2://$APP :$( cat " $DB_APP_PASSWORD " ) @\$ MARIADB_PORT_3306_TCP_ADDR:\$ MARIADB_PORT_3306_TCP_PORT/$DB_NAME
1515EOF
16- verbose " Linking MariaDB database $DB_NAME to application" 1>&2
16+ verbose " Linking MariaDB database $DB_NAME to application"
1717 done
1818fi
Original file line number Diff line number Diff line change @@ -13,6 +13,6 @@ if [[ -d "$DB_LINKS" ]] && [[ -f "$DB_APP_PASSWORD" ]] && [[ $(ls -1 "$DB_LINKS"
1313 docker run -i -a stdin " $IMAGE " /bin/bash -c " cat >> /app/.env" << EOF | commit_image "$IMAGE "
1414[ "\$ MARIADB_NAME" != "" ] && export DATABASE_URL=mysql2://$APP :$( cat " $DB_APP_PASSWORD " ) @\$ MARIADB_PORT_3306_TCP_ADDR:\$ MARIADB_PORT_3306_TCP_PORT/$DB_NAME
1515EOF
16- verbose " Linking MariaDB database $DB_NAME to application" 1>&2
16+ verbose " Linking MariaDB database $DB_NAME to application"
1717 done
1818fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ source " $( dirname $0 ) /vars"
4+
5+ verify_app_name " $1 "
6+
7+ DB_LINKS=" $DB_APP_DATABASES$APP /"
8+ DB_APP_PASSWORD=" $DB_APP_PASSWORDS$APP "
9+
10+ # inject MARIADB_URL
11+ if [[ -d " $DB_LINKS " ]] && [[ -f " $DB_APP_PASSWORD " ]] && [[ $( ls -1 " $DB_LINKS " | wc -l) -gt 0 ]]; then
12+ ls -1 " $DB_LINKS " | while read DB_NAME; do
13+ ensure_database_container_is_running
14+ break
15+ done
16+ fi
Original file line number Diff line number Diff line change @@ -14,3 +14,16 @@ DB_PORT=3306
1414
1515DB_APP_PASSWORDS=" $DB_ROOT /pwd_app_"
1616DB_APP_DATABASES=" $DB_ROOT /dbs_app_"
17+
18+ function ensure_database_container_is_running() {
19+ # remove it silently
20+ remove_container " $DB_CONTAINER "
21+
22+ # and start detached
23+ docker run --detach " --publish=$DB_PORT " \
24+ --volume=" $DB_VOLUME " :" $DB_CONTAINER_VOLUME " \
25+ --volume=" $DB_ADMIN_PASSWORD " :" $DB_CONTAINER_PASSWORD " \
26+ --name=" $DB_CONTAINER " \
27+ " $DB_IMAGE " \
28+ /usr/bin/start_mariadb.sh > /dev/null
29+ }
Original file line number Diff line number Diff line change @@ -17,12 +17,6 @@ if [[ ! -f "$DB_ADMIN_PASSWORD" ]]; then
1717fi
1818
1919stop_and_remove_container " $DB_CONTAINER "
20-
21- docker run --detach " --publish=$DB_PORT " \
22- --volume=" $DB_VOLUME " :" $DB_CONTAINER_VOLUME " \
23- --volume=" $DB_ADMIN_PASSWORD " :" $DB_CONTAINER_PASSWORD " \
24- --name=" $DB_CONTAINER " \
25- " $DB_IMAGE " \
26- /usr/bin/start_mongodb.sh > /dev/null
20+ ensure_database_container_is_running
2721
2822cat
Original file line number Diff line number Diff line change @@ -13,6 +13,6 @@ if [[ -d "$DB_LINKS" ]] && [[ -f "$DB_APP_PASSWORD" ]] && [[ $(ls -1 "$DB_LINKS"
1313 docker run -i -a stdin " $IMAGE " /bin/bash -c " cat > /app/.profile.d/mongodb_env" << EOF | commit_image "$IMAGE "
1414[ "\$ MONGODB_NAME" != "" ] && export MONGODB_URL=mongodb://$APP :$( cat " $DB_APP_PASSWORD " ) @\$ MONGODB_PORT_${DB_PORT} _TCP_ADDR:\$ MONGODB_PORT_${DB_PORT} _TCP_PORT/$DB_NAME
1515EOF
16- verbose " Linking MongoDB database $DB_NAME to application" 1>&2
16+ verbose " Linking MongoDB database $DB_NAME to application"
1717 done
1818fi
Original file line number Diff line number Diff line change @@ -13,6 +13,6 @@ if [[ -d "$DB_LINKS" ]] && [[ -f "$DB_APP_PASSWORD" ]] && [[ $(ls -1 "$DB_LINKS"
1313 docker run -i -a stdin " $IMAGE " /bin/bash -c " cat >> /app/.env" << EOF | commit_image "$IMAGE "
1414[ "\$ MONGODB_NAME" != "" ] && export MONGODB_URL=mongodb://$APP :$( cat " $DB_APP_PASSWORD " ) @\$ MONGODB_PORT_${DB_PORT} _TCP_ADDR:\$ MONGODB_PORT_${DB_PORT} _TCP_PORT/$DB_NAME
1515EOF
16- verbose " Linking MongoDB database $DB_NAME to application" 1>&2
16+ verbose " Linking MongoDB database $DB_NAME to application"
1717 done
1818fi
You can’t perform that action at this time.
0 commit comments