From b24cf51f37cd1ba1ad4f14c7f7ec70cec4ec289d Mon Sep 17 00:00:00 2001 From: alojua Date: Fri, 17 Aug 2018 13:30:17 +0200 Subject: [PATCH 1/4] Use unison image --- config/docker/image/unison/Dockerfile | 42 -------- .../image/unison/scripts/init_sync_config.sh | 96 ------------------- config/docker/image/unison/scripts/sync.sh | 15 --- config/docker/image/unison/scripts/watch.sh | 15 --- docker-compose.yml | 2 +- 5 files changed, 1 insertion(+), 169 deletions(-) delete mode 100644 config/docker/image/unison/Dockerfile delete mode 100644 config/docker/image/unison/scripts/init_sync_config.sh delete mode 100644 config/docker/image/unison/scripts/sync.sh delete mode 100644 config/docker/image/unison/scripts/watch.sh diff --git a/config/docker/image/unison/Dockerfile b/config/docker/image/unison/Dockerfile deleted file mode 100644 index c4b49cf..0000000 --- a/config/docker/image/unison/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM alpine:3.5 -MAINTAINER Juan Alonso - -# Install needed packages. -#RUN apt-get -qq update && \ -# apt-get -qq install inotify-tools rsync unison-all && \ -# apt-get clean && \ -# rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* - -# Alpine doesn't ship with Bash. -RUN apk add --no-cache bash - -# Install Unison from source with inotify support + remove compilation tools -ARG UNISON_VERSION=2.48.4 -RUN apk add --no-cache --virtual .build-dependencies build-base curl && \ - apk add --no-cache inotify-tools && \ - apk add --no-cache --repository http://dl-4.alpinelinux.org/alpine/edge/testing/ ocaml && \ - curl -L https://github.com/bcpierce00/unison/archive/$UNISON_VERSION.tar.gz | tar zxv -C /tmp && \ - cd /tmp/unison-${UNISON_VERSION} && \ - sed -i -e 's/GLIBC_SUPPORT_INOTIFY 0/GLIBC_SUPPORT_INOTIFY 1/' src/fsmonitor/linux/inotify_stubs.c && \ - make UISTYLE=text NATIVE=true STATIC=true && \ - cp src/unison src/unison-fsmonitor /usr/local/bin && \ - apk del .build-dependencies ocaml && \ - rm -rf /tmp/unison-${UNISON_VERSION} - -COPY scripts/init_sync_config.sh /usr/local/bin/init_sync_config -RUN chmod +x /usr/local/bin/init_sync_config - -COPY scripts/sync.sh /usr/local/bin/sync -RUN chmod +x /usr/local/bin/sync - -COPY scripts/watch.sh /usr/local/bin/watch -RUN chmod +x /usr/local/bin/watch - -RUN addgroup -g 1000 -S app \ - && adduser -u 1000 -D -S -G app app - -RUN mkdir -p /home/app/.unison -RUN touch /home/app/unison.log -RUN chown -R app:app /home/app - -CMD init_sync_config && tail -f /dev/null \ No newline at end of file diff --git a/config/docker/image/unison/scripts/init_sync_config.sh b/config/docker/image/unison/scripts/init_sync_config.sh deleted file mode 100644 index 4319321..0000000 --- a/config/docker/image/unison/scripts/init_sync_config.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail - -log_heading() { - echo "" - echo "==> $*" -} - -log_info() { - echo "-----> $*" -} - -log_error_exit() { - echo " ! Error:" - echo " ! $*" - echo " ! Aborting!" - exit 1 -} - -: ${SYNC_SOURCE_BASE_PATH:="/sync"} -: ${SYNC_DESTINATION_BASE_PATH:="/var/www/html"} -: ${SYNC_PREFER:="newer"} -: ${SYNC_SILENT:="0"} -: ${SYNC_MAX_INOTIFY_WATCHES:=''} -: ${SYNC_EXTRA_UNISON_PROFILE_OPTS:=''} -: ${SYNC_NODELETE_SOURCE:="0"} - -log_heading "Configuration:" -log_info "SYNC_SOURCE_BASE_PATH: $SYNC_SOURCE_BASE_PATH" -log_info "SYNC_DESTINATION_BASE_PATH: $SYNC_DESTINATION_BASE_PATH" - -[ -d "$SYNC_SOURCE_BASE_PATH" ] || log_error_exit "Source directory does not exist!" -[ -d "$SYNC_DESTINATION_BASE_PATH" ] || log_error_exit "Destination directory does not exist!" -[[ "$SYNC_SOURCE_BASE_PATH" != "$SYNC_DESTINATION_BASE_PATH" ]] || log_error_exit "Source and destination must be different directories!" - -if [ -n "${SYNC_MAX_INOTIFY_WATCHES}" ]; then - if [ -z "$(sysctl -p)" ]; then - echo fs.inotify.max_user_watches=$SYNC_MAX_INOTIFY_WATCHES | tee -a /etc/sysctl.conf && sysctl -p - else - log_info "Looks like /etc/sysctl.conf already has fs.inotify.max_user_watches defined." - log_info "Skipping this step." - fi -fi - -prefer="prefer=newer" -if [ -z "${SYNC_PREFER}" ]; then - prefer="prefer=${SYNC_PREFER}" -fi - -silent="silent=false" -if [[ "$SYNC_SILENT" == "1" ]]; then - silent="silent=true" -fi - -nodeletion="" -if [[ "$SYNC_NODELETE_SOURCE" == "1" ]]; then - nodeletion="nodeletion=${SYNC_SOURCE_BASE_PATH}" -fi - -echo " -# Sync roots -root = $SYNC_SOURCE_BASE_PATH -root = $SYNC_DESTINATION_BASE_PATH - -# Sync options -auto=true -backups=false -batch=true -contactquietly=true -fastcheck=true -maxthreads=10 -$prefer -$silent -$nodeletion - -# Files to ignore -ignore = Path .git/* -ignore = Path .idea/* -ignore = Name *___jb_tmp___* -ignore = Name {.*,*}.sw[pon] - -# Additional user configuration -$SYNC_EXTRA_UNISON_PROFILE_OPTS - -" > /home/app/.unison/common - -echo " -include common - -" > /home/app/.unison/sync - -echo " -repeat=watch -include common - -" > /home/app/.unison/watch \ No newline at end of file diff --git a/config/docker/image/unison/scripts/sync.sh b/config/docker/image/unison/scripts/sync.sh deleted file mode 100644 index 473ef56..0000000 --- a/config/docker/image/unison/scripts/sync.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -usage() -{ - echo "usage: sync -path " -} - -args="$@" - -if [[ ${args} != *"-path "* ]]; then - usage - exit 1 -fi - -su -c "unison sync $args" -s /bin/sh app \ No newline at end of file diff --git a/config/docker/image/unison/scripts/watch.sh b/config/docker/image/unison/scripts/watch.sh deleted file mode 100644 index 9f9826e..0000000 --- a/config/docker/image/unison/scripts/watch.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -usage() -{ - echo "usage: watch -path " -} - -args="$@" - -if [[ ${args} != *"-path "* ]]; then - usage - exit 1 -fi - -su -c "unison watch $args" -s /bin/sh app \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index ce75202..4c55ad1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,7 +46,7 @@ services: - dbdata:/var/lib/mysql unison: - build: ./config/docker/image/unison + image: modestcoders/unison:2.51.2 volumes: - app-vendor:/var/www/html/vendor - app-generated:/var/www/html/generated From e32bb6039c81fa76d2d33e91c060186ec0d6a099 Mon Sep 17 00:00:00 2001 From: alojua Date: Fri, 17 Aug 2018 14:12:31 +0200 Subject: [PATCH 2/4] Update php version to 7.1 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4c55ad1..3fa6011 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: - unison phpfpm: - image: markoshust/magento-php:7.0-fpm-3 + image: markoshust/magento-php:7.1-fpm-3 volumes: *appvolumes environment: PHP_IDE_CONFIG: serverName=localhost @@ -59,7 +59,7 @@ services: privileged: true node: - image: modestcoders/node-php:node8-php7.0 + image: modestcoders/node-php:node8-php7.1 volumes: *appvolumes environment: - NPM_CONFIG_PREFIX=/home/node/.npm-global # To avoid permission error on npm install. It tries to save it at /var/www (root is the owner) From e53c71331f4ea715757b0cc6be8cf64a569a4d88 Mon Sep 17 00:00:00 2001 From: alojua Date: Fri, 17 Aug 2018 14:18:32 +0200 Subject: [PATCH 3/4] Update changelogs for versions 1.0.1 and 1.1 --- CHANGELOG.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c401a..87d3641 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Version](http://semver.org/spec/v2.0.0.html). -## [version] - date +## [future-version] - 00-00-2018 ### Added ### Changed -### Removed \ No newline at end of file +### Removed + +## [1.1] - 18-08-2018 +### Changed + +* Use `modestcoders/unison:2.51.2` image for unison container +* Update `markoshust/magento-php` images to PHP `7.1` using tag `7.1-fpm-3` + +## [1.0.1] - 15-08-2018 +### Changed + +* Use `modestcoders/node-php:node8-php7.0` image for node container \ No newline at end of file From 8b1980f0b52ae5a292ddb4df5d3dab74c6ad0b08 Mon Sep 17 00:00:00 2001 From: alojua Date: Tue, 21 Aug 2018 09:30:08 +0200 Subject: [PATCH 4/4] Add more dependencies to containers, so they work properly when they are started individually --- docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3fa6011..a071a87 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: depends_on: - app-volumes - db + - unison db: image: mysql:5.7 @@ -56,6 +57,8 @@ services: - SYNC_SOURCE_BASE_PATH=/sync - SYNC_DESTINATION_BASE_PATH=/var/www/html - SYNC_MAX_INOTIFY_WATCHES=60000 + depends_on: + - app-volumes privileged: true node: