diff --git a/.circleci/config.yml b/.circleci/config.yml index 85d4130..905a54e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,7 +29,7 @@ builddeploy_steps: &builddeploy_steps - run: *install_dependency - run: *install_deploysuite #- restore_cache: *restore_cache_settings_for_build - - run: ./build.sh ${APPNAME} ${CI_DEPLOY_TOKEN} ${LOGICAL_ENV} ${BRANCH} ${TIDEWAYS_ENVIRONMENT} + - run: ./build.sh ${APPNAME} ${CI_DEPLOY_TOKEN} ${LOGICAL_ENV} ${BRANCH} ${TIDEWAYS_ENV} #- save_cache: *save_cache_settings - deploy: name: Running MasterScript. diff --git a/Dockerfile b/Dockerfile index 1e4a9c0..3e83e14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,15 @@ ARG CI_DEPLOY_TOKEN ARG VANILLA_VERSION=3.3 ARG ENV ARG BRANCH +ARG TIDEWAYS_ENV ENV TIDEWAYS_SERVICE web +ENV TIDEWAYS_ENVIRONMENT=$TIDEWAYS_ENV +ENV TIDEWAYS_DAEMON_EXTRA="--env=$TIDEWAYS_ENVIRONMENT" ENV WEB_DOCUMENT_ROOT /vanillapp +RUN echo "Tideways Daemon for '$TIDEWAYS_ENV' env" + # Get the latest release of Vanilla Forums RUN wget https://github.com/vanilla/vanilla/releases/download/Vanilla_${VANILLA_VERSION}/vanilla-${VANILLA_VERSION}.zip RUN unzip vanilla-${VANILLA_VERSION}.zip -d /tmp @@ -74,14 +79,14 @@ RUN apt-get update && apt-get install -yq --no-install-recommends gnupg2; RUN echo 'deb https://packages.tideways.com/apt-packages debian main' > /etc/apt/sources.list.d/tideways.list && \ curl -L -sS 'https://packages.tideways.com/key.gpg' | apt-key add - && \ apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get -yq install tideways-php && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install tideways-php tideways-daemon && \ apt-get autoremove --assume-yes && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; \ - echo 'extension=tideways.so\ntideways.connection=tcp://tideways-daemon:9135\ntideways.enable_cli=0\ntideways.sample_rate=25' >> opt/docker/etc/php/php.ini; + echo 'extension=tideways.so\ntideways.enable_cli=0\ntideways.sample_rate=25' >> opt/docker/etc/php/php.ini; # Copy custom supervisor's configs and scripts # Netcat is used to connect to a memcached server RUN apt-get update && apt-get install -y netcat -COPY ./services/flush_cache.conf /opt/docker/etc/supervisor.d/ -COPY ./services/flush_cache.sh /opt/docker/bin/service.d/ \ No newline at end of file +COPY ./services /opt/docker/etc/supervisor.d/ +COPY ./services /opt/docker/bin/service.d/ \ No newline at end of file diff --git a/build.sh b/build.sh index 87608fd..6a34c4b 100755 --- a/build.sh +++ b/build.sh @@ -7,5 +7,5 @@ BRANCH=$4 TIDEWAYS_ENV=$5 UPDATE_CACHE="" echo "" > vanilla.env -ENV=$ENV CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN BRANCH=$BRANCH TIDEWAYS_ENV=$TIDEWAYS_ENV docker-compose -f docker-compose.yml -f docker-compose.dev.yml build $APP_NAME +ENV=$ENV CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN BRANCH=$BRANCH TIDEWAYS_ENV=$TIDEWAYS_ENV docker-compose -f docker-compose.yml build $APP_NAME #docker create --name app $APP_NAME:latest \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 43dab53..0e4a518 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,5 +12,6 @@ services: - VANILLA_VERSION=3.3 - CI_DEPLOY_TOKEN - BRANCH + - TIDEWAYS_ENV ports: - 80:80 \ No newline at end of file diff --git a/services/tideways.conf b/services/tideways.conf new file mode 100644 index 0000000..40e9068 --- /dev/null +++ b/services/tideways.conf @@ -0,0 +1,15 @@ +[group:tideways] +programs=tideways +priority=10 + +[program:tideways] +command=/opt/docker/bin/service.d/tideways.sh +process_name=%(program_name)s +startsecs=0 +startretries=0 +autostart=true +autorestart=false +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 \ No newline at end of file diff --git a/services/tideways.sh b/services/tideways.sh new file mode 100644 index 0000000..a3c0774 --- /dev/null +++ b/services/tideways.sh @@ -0,0 +1,9 @@ +#!/bin/sh +echo tideways.sh: Tideways Daemon for $TIDEWAYS_ENVIRONMENT +/etc/init.d/tideways-daemon start +exit_code=$? +if [ $exit_code != 0 ]; then + echo tideways.sh: exit code $exit_code +else + echo tideways.sh: started successfully +fi \ No newline at end of file