From 494c5362b63dd235206bce46d8698589681a37b3 Mon Sep 17 00:00:00 2001 From: Tristan Storch Date: Fri, 29 Aug 2014 18:20:15 +0200 Subject: [PATCH] Docker mix and match setup Rewrite of the docker setup. Now uses fig to manage containers and container linkage. The base is a block based mix and match, which will give you the possibility to easily test all configurations. --- docker/README.md | 77 +++++++++++++++++++ docker/assemble_blocks.sh | 70 +++++++++++++++++ docker/blocks/docker_cache_memcache/config | 3 + docker/blocks/docker_cache_memcache/fig | 2 + docker/blocks/docker_cache_redis/config | 3 + docker/blocks/docker_cache_redis/fig | 2 + docker/blocks/docker_database_mysql/config | 6 ++ docker/blocks/docker_database_mysql/fig | 7 ++ .../blocks/docker_database_postgresql/config | 6 ++ docker/blocks/docker_database_postgresql/fig | 6 ++ docker/blocks/docker_gogs/Dockerfile | 25 ++++++ docker/blocks/docker_gogs/fig | 4 + docker/blocks/docker_gogs_w_cache/Dockerfile | 25 ++++++ docker/blocks/docker_gogs_w_cache/fig | 6 ++ .../docker_gogs_w_cache_session/Dockerfile | 25 ++++++ docker/blocks/docker_gogs_w_cache_session/fig | 7 ++ docker/blocks/docker_gogs_w_db/Dockerfile | 25 ++++++ docker/blocks/docker_gogs_w_db/fig | 6 ++ .../blocks/docker_gogs_w_db_cache/Dockerfile | 25 ++++++ docker/blocks/docker_gogs_w_db_cache/fig | 7 ++ .../docker_gogs_w_db_cache_session/Dockerfile | 25 ++++++ .../blocks/docker_gogs_w_db_cache_session/fig | 8 ++ .../docker_gogs_w_db_session/Dockerfile | 25 ++++++ docker/blocks/docker_gogs_w_db_session/fig | 7 ++ .../blocks/docker_gogs_w_session/Dockerfile | 25 ++++++ docker/blocks/docker_gogs_w_session/fig | 6 ++ docker/blocks/docker_session_mysql/config | 3 + docker/blocks/docker_session_mysql/fig | 7 ++ docker/docker/.gitkeep | 0 docker/templates/init_gogs.sh.tpl | 13 ++++ 30 files changed, 456 insertions(+) create mode 100644 docker/README.md create mode 100755 docker/assemble_blocks.sh create mode 100644 docker/blocks/docker_cache_memcache/config create mode 100644 docker/blocks/docker_cache_memcache/fig create mode 100644 docker/blocks/docker_cache_redis/config create mode 100644 docker/blocks/docker_cache_redis/fig create mode 100644 docker/blocks/docker_database_mysql/config create mode 100644 docker/blocks/docker_database_mysql/fig create mode 100644 docker/blocks/docker_database_postgresql/config create mode 100644 docker/blocks/docker_database_postgresql/fig create mode 100644 docker/blocks/docker_gogs/Dockerfile create mode 100644 docker/blocks/docker_gogs/fig create mode 100644 docker/blocks/docker_gogs_w_cache/Dockerfile create mode 100644 docker/blocks/docker_gogs_w_cache/fig create mode 100644 docker/blocks/docker_gogs_w_cache_session/Dockerfile create mode 100644 docker/blocks/docker_gogs_w_cache_session/fig create mode 100644 docker/blocks/docker_gogs_w_db/Dockerfile create mode 100644 docker/blocks/docker_gogs_w_db/fig create mode 100644 docker/blocks/docker_gogs_w_db_cache/Dockerfile create mode 100644 docker/blocks/docker_gogs_w_db_cache/fig create mode 100644 docker/blocks/docker_gogs_w_db_cache_session/Dockerfile create mode 100644 docker/blocks/docker_gogs_w_db_cache_session/fig create mode 100644 docker/blocks/docker_gogs_w_db_session/Dockerfile create mode 100644 docker/blocks/docker_gogs_w_db_session/fig create mode 100644 docker/blocks/docker_gogs_w_session/Dockerfile create mode 100644 docker/blocks/docker_gogs_w_session/fig create mode 100644 docker/blocks/docker_session_mysql/config create mode 100644 docker/blocks/docker_session_mysql/fig create mode 100644 docker/docker/.gitkeep create mode 100644 docker/templates/init_gogs.sh.tpl diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..31cc0dec9 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,77 @@ +Docker +====== + +TOOLS ARE WRITTEN FOR TESTING AND TO SEE WHAT IT IS! + +For this to work you will need the nifty docker tool [fig]. + +The most simple setup will look like this: + +```sh +./assemble_blocks.sh docker_gogs_w_db docker_database_mysql +fig up + +``` + +That's it. You have GoGS running in docker linked to a MySQL docker container. + +Now visit http://localhost:3000/ and give details for the admin account an you're up and running. + + +How does it work +---------------- + +`./assemble_blocks.sh` will look in `blocks` for subdirectories. +In the subdirectories there are to relevant files: `Dockerfile`, `config` and `fig`. + +`Dockerfile` will be copied to `docker/` (also means last `Dockerfile` wins). + +The `config` file contains lines which will in the gogs docker container end up in `$GOGS_PATH/custom/config/app.ini` and by this gogs will be configured. +Here you can define things like the MySQL server for your database block. + +The `fig` file will just be added to `fig.yml`, which is used by fig to manage your containers. +This inculdes container linking! + +Just have a look at them and it will be clear how to write your own blocks. + +Just some things + + - all files (`Dockerfile`, `fig` and `config`) are optional + - the gogs block should always be the first block + + +More sophisticated Example +-------------------------- + +Her is a more elaborated example + +```sh +./assemble_blocks.sh docker_gogs_w_db_cache_session docker_database_postgresql docker_cache_redis docker_session_mysql +fig up +``` + +This will set up four containters. One for each of + + - gogs + - database (postgresql) + - cache (redis) + - session (mysql) + +WARNING: This will not work at the Moment! MySQL session is broken! + + +Remark +------ + +After you change something you should always trigger `fig build` to inculde the the new init script `init_gogs.sh` in the docker image. + +If you want to use another GoGS docker file, but keep everything else the same, you can create a block, e.g. `docker_gogs_dev`, with only a `Dockerfile` and call + +```sh +./assemble_blocks.sh docker_gogs_w_db docker_gogs_dev docker_database_mysql +``` + +This will override the `Dockerfile` from `docker_gogs_w_db` with the one from `docker_gogs_dev` + + +[fig]:http://www.fig.sh/ \ No newline at end of file diff --git a/docker/assemble_blocks.sh b/docker/assemble_blocks.sh new file mode 100755 index 000000000..3fdc43ceb --- /dev/null +++ b/docker/assemble_blocks.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +blocks_dir=blocks +docker_dir=docker +template_dir=templates + +docker_file=Dockerfile + +gogs_config_file=conf.tmp +gogs_config=config +gogs_init_file=$docker_dir/init_gogs.sh + +fig_file=fig.yml +fig_config=fig + +gogs_init_template=$template_dir/init_gogs.sh.tpl + +if [ "$#" == 0 ]; then + blocks=`ls $blocks_dir` + if [ -z "$blocks" ]; then + echo "No Blocks available in $blocks_dir" + else + echo "Available Blocks:" + for block in $blocks; do + echo " $block" + done + fi + exit 0 +fi + +for file in $gogs_config_file $fig_file; do + if [ -e $file ]; then + echo "Deleting $file" + rm $file + fi +done + +for dir in $@; do + current_dir=$blocks_dir/$dir + if [ ! -d "$current_dir" ]; then + echo "$current_dir is not a directory" + exit 1 + fi + + if [ -e $current_dir/$docker_file ]; then + echo "Copying $current_dir/$docker_file to $docker_dir/$docker_file" + cp $current_dir/$docker_file $docker_dir/$docker_file + fi + + if [ -e $current_dir/$gogs_config ]; then + echo "Adding $current_dir/$gogs_config to $gogs_config_file" + cat $current_dir/$gogs_config >> $gogs_config_file + echo "" >> $gogs_config_file + fi + + if [ -e $current_dir/$fig_config ]; then + echo "Adding $current_dir/$fig_config to $fig_file" + cat $current_dir/fig >> $fig_file + echo "" >> $fig_file + fi +done + +echo "Creating $gogs_init_file" +sed "/{{ CONFIG }}/{ +r $gogs_config_file +d +}" $gogs_init_template > $gogs_init_file + +echo "Removing temporary GoGS config" +rm $gogs_config_file \ No newline at end of file diff --git a/docker/blocks/docker_cache_memcache/config b/docker/blocks/docker_cache_memcache/config new file mode 100644 index 000000000..daca6f3ef --- /dev/null +++ b/docker/blocks/docker_cache_memcache/config @@ -0,0 +1,3 @@ +[cache] +DB_TYPE = memcache +HOST = HOST = ${CACHE_1_PORT_11211_TCP_ADDR}:${CACHE_1_PORT_11211_TCP_PORT} diff --git a/docker/blocks/docker_cache_memcache/fig b/docker/blocks/docker_cache_memcache/fig new file mode 100644 index 000000000..80d0215cc --- /dev/null +++ b/docker/blocks/docker_cache_memcache/fig @@ -0,0 +1,2 @@ +cache: + image: sylvainlasnier/memcached:latest diff --git a/docker/blocks/docker_cache_redis/config b/docker/blocks/docker_cache_redis/config new file mode 100644 index 000000000..648f4f380 --- /dev/null +++ b/docker/blocks/docker_cache_redis/config @@ -0,0 +1,3 @@ +[cache] +DB_TYPE = redis +HOST = ${CACHE_1_PORT_6379_TCP_ADDR}:${CACHE_1_PORT_6379_TCP_PORT} diff --git a/docker/blocks/docker_cache_redis/fig b/docker/blocks/docker_cache_redis/fig new file mode 100644 index 000000000..0e74bc4ae --- /dev/null +++ b/docker/blocks/docker_cache_redis/fig @@ -0,0 +1,2 @@ +cache: + image: redis:latest diff --git a/docker/blocks/docker_database_mysql/config b/docker/blocks/docker_database_mysql/config new file mode 100644 index 000000000..53f8949d9 --- /dev/null +++ b/docker/blocks/docker_database_mysql/config @@ -0,0 +1,6 @@ +[database] +DB_TYPE = mysql +HOST = ${DB_1_PORT_3306_TCP_ADDR}:${DB_1_PORT_3306_TCP_PORT} +NAME = ${DB_1_ENV_MYSQL_DATABASE} +USER = ${DB_1_ENV_MYSQL_USER} +PASSWD = ${DB_1_ENV_MYSQL_PASSWORD} diff --git a/docker/blocks/docker_database_mysql/fig b/docker/blocks/docker_database_mysql/fig new file mode 100644 index 000000000..a005a0593 --- /dev/null +++ b/docker/blocks/docker_database_mysql/fig @@ -0,0 +1,7 @@ +db: + image: mysql:latest + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: gogs + MYSQL_USER: gogs + MYSQL_PASSWORD: password diff --git a/docker/blocks/docker_database_postgresql/config b/docker/blocks/docker_database_postgresql/config new file mode 100644 index 000000000..e5946b06d --- /dev/null +++ b/docker/blocks/docker_database_postgresql/config @@ -0,0 +1,6 @@ +[database] +DB_TYPE = postgres +HOST = ${DB_1_PORT_5432_TCP_ADDR}:${DB_1_PORT_5432_TCP_PORT} +NAME = ${DB_1_ENV_POSTGRESQL_DB} +USER = ${DB_1_ENV_POSTGRESQL_USER} +PASSWD = ${DB_1_ENV_POSTGRESQL_PASS} diff --git a/docker/blocks/docker_database_postgresql/fig b/docker/blocks/docker_database_postgresql/fig new file mode 100644 index 000000000..c839e9044 --- /dev/null +++ b/docker/blocks/docker_database_postgresql/fig @@ -0,0 +1,6 @@ +db: + image: wyaeld/postgres:9.3 + environment: + POSTGRESQL_DB: gogs + POSTGRESQL_USER: gogs + POSTGRESQL_PASS: password diff --git a/docker/blocks/docker_gogs/Dockerfile b/docker/blocks/docker_gogs/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs/fig b/docker/blocks/docker_gogs/fig new file mode 100644 index 000000000..c0fed209d --- /dev/null +++ b/docker/blocks/docker_gogs/fig @@ -0,0 +1,4 @@ +gogs: + build: docker + ports: + - "3000:3000" diff --git a/docker/blocks/docker_gogs_w_cache/Dockerfile b/docker/blocks/docker_gogs_w_cache/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs_w_cache/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_w_cache/fig b/docker/blocks/docker_gogs_w_cache/fig new file mode 100644 index 000000000..fd66c3578 --- /dev/null +++ b/docker/blocks/docker_gogs_w_cache/fig @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - cache + ports: + - "3000:3000" diff --git a/docker/blocks/docker_gogs_w_cache_session/Dockerfile b/docker/blocks/docker_gogs_w_cache_session/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs_w_cache_session/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_w_cache_session/fig b/docker/blocks/docker_gogs_w_cache_session/fig new file mode 100644 index 000000000..0f9011406 --- /dev/null +++ b/docker/blocks/docker_gogs_w_cache_session/fig @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - cache + - session + ports: + - "3000:3000" diff --git a/docker/blocks/docker_gogs_w_db/Dockerfile b/docker/blocks/docker_gogs_w_db/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs_w_db/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_w_db/fig b/docker/blocks/docker_gogs_w_db/fig new file mode 100644 index 000000000..a7e9c1b69 --- /dev/null +++ b/docker/blocks/docker_gogs_w_db/fig @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - db + ports: + - "3000:3000" diff --git a/docker/blocks/docker_gogs_w_db_cache/Dockerfile b/docker/blocks/docker_gogs_w_db_cache/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs_w_db_cache/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_w_db_cache/fig b/docker/blocks/docker_gogs_w_db_cache/fig new file mode 100644 index 000000000..42402e40f --- /dev/null +++ b/docker/blocks/docker_gogs_w_db_cache/fig @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - db + - cache + ports: + - "3000:3000" diff --git a/docker/blocks/docker_gogs_w_db_cache_session/Dockerfile b/docker/blocks/docker_gogs_w_db_cache_session/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs_w_db_cache_session/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_w_db_cache_session/fig b/docker/blocks/docker_gogs_w_db_cache_session/fig new file mode 100644 index 000000000..42444405a --- /dev/null +++ b/docker/blocks/docker_gogs_w_db_cache_session/fig @@ -0,0 +1,8 @@ +gogs: + build: docker + links: + - db + - cache + - session + ports: + - "3000:3000" diff --git a/docker/blocks/docker_gogs_w_db_session/Dockerfile b/docker/blocks/docker_gogs_w_db_session/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs_w_db_session/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_w_db_session/fig b/docker/blocks/docker_gogs_w_db_session/fig new file mode 100644 index 000000000..3703c6ba3 --- /dev/null +++ b/docker/blocks/docker_gogs_w_db_session/fig @@ -0,0 +1,7 @@ +gogs: + build: docker + links: + - db + - session + ports: + - "3000:3000" diff --git a/docker/blocks/docker_gogs_w_session/Dockerfile b/docker/blocks/docker_gogs_w_session/Dockerfile new file mode 100644 index 000000000..f7458a147 --- /dev/null +++ b/docker/blocks/docker_gogs_w_session/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN useradd -m git + +ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs +ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf +ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini + +RUN go get github.com/gogits/gogs +# WORKDIR $GOGS_PATH +WORKDIR /go/src/github.com/gogits/gogs +RUN go build github.com/gogits/gogs +RUN chown -R git $GOGS_PATH + +ADD init_gogs.sh /tmp/ +RUN chown git /tmp/init_gogs.sh +RUN chmod +x /tmp/init_gogs.sh + +USER git +ENV HOME /home/git +ENV USER git +ENV PATH $GOGS_PATH:$PATH + +ENTRYPOINT ["/tmp/init_gogs.sh"] +CMD ["gogs", "web"] diff --git a/docker/blocks/docker_gogs_w_session/fig b/docker/blocks/docker_gogs_w_session/fig new file mode 100644 index 000000000..7dda0dde9 --- /dev/null +++ b/docker/blocks/docker_gogs_w_session/fig @@ -0,0 +1,6 @@ +gogs: + build: docker + links: + - session + ports: + - "3000:3000" diff --git a/docker/blocks/docker_session_mysql/config b/docker/blocks/docker_session_mysql/config new file mode 100644 index 000000000..b8bc2cc70 --- /dev/null +++ b/docker/blocks/docker_session_mysql/config @@ -0,0 +1,3 @@ +[session] +PROVIDER = mysql +PROVIDER_CONFIG = ${SESSION_1_ENV_MYSQL_USER}:${SESSION_1_ENV_MYSQL_PASSWORD}@SESSION_1_PORT_3306_TCP_PROTO(${SESSION_1_PORT_3306_TCP_ADDR}:${SESSION_1_PORT_3306_TCP_PORT})/${SESSION_1_ENV_MYSQL_DATABASE} diff --git a/docker/blocks/docker_session_mysql/fig b/docker/blocks/docker_session_mysql/fig new file mode 100644 index 000000000..0e2dbf19c --- /dev/null +++ b/docker/blocks/docker_session_mysql/fig @@ -0,0 +1,7 @@ +session: + image: mysql:latest + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: gogs_session + MYSQL_USER: gogs + MYSQL_PASSWORD: password diff --git a/docker/docker/.gitkeep b/docker/docker/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/docker/templates/init_gogs.sh.tpl b/docker/templates/init_gogs.sh.tpl new file mode 100644 index 000000000..ea1120691 --- /dev/null +++ b/docker/templates/init_gogs.sh.tpl @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ ! -d "$DIRECTORY" ]; then + mkdir -p $GOGS_CUSTOM_CONF_PATH + + #~ Either "dev", "prod" or "test", default is "dev" +echo " +{{ CONFIG }} +" >> $GOGS_CUSTOM_CONF + +fi + +exec "$@"