...
 
Commits (7)
......@@ -6,6 +6,8 @@ services:
stages:
- build
- test
- prepare
- staging
- deploy
cache:
......@@ -27,22 +29,80 @@ build:
test:
stage: test
image: php:7.1.11-fpm-alpine3.4 # TODO: Fix cassandra driver conflicts
image: minds/php-tests:latest
script:
- apk update && apk add libpng-dev freetype-dev libjpeg-turbo-dev
- docker-php-ext-install mbstring
- docker-php-ext-install bcmath
- docker-php-ext-install gd
- bin/phpspec run
prepare:fpm:
stage: prepare
image: minds/ci:latest
script:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker build -t $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF -f containers/php-fpm/Dockerfile .
- docker push $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF
prepare:runners:
stage: prepare
image: minds/ci:latest
script:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker build -t $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF -f containers/php-runners/Dockerfile .
- docker push $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF
staging:start:
stage: staging
image: minds/helm-eks:latest
script:
- aws eks update-kubeconfig --name=sandbox
- STAGING_SUBDOMAIN=$(echo $CI_COMMIT_MESSAGE | sed -n 's/.* -subdomain=\([^ ]*\).*/\1/p')
- echo "Subdomain will be setup at $STAGING_SUBDOMAIN"
- git clone --branch=sandbox-wip https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/minds/helm-charts.git
- "helm upgrade \
--install \
--reuse-values \
--set phpfpm.image.repository=$CI_REGISTRY_IMAGE/fpm \
--set phpfpm.image.tag=$CI_BUILD_REF \
--set domain=$STAGING_SUBDOMAIN.$STAGING_DOMAIN \
--wait \
$STAGING_SUBDOMAIN \
./helm-charts/minds"
only:
variables:
- $CI_COMMIT_MESSAGE =~ /-subdomain/
environment:
name: staging
except:
refs:
- master
- test/gitlab-ci
staging:stop:
stage: staging
image: minds/helm-eks:latest
script:
- aws eks update-kubeconfig --name=sandbox
- STAGING_SUBDOMAIN=$(echo $CI_COMMIT_MESSAGE | sed -n 's/.* -subdomain=\([^ ]*\).*/\1/p')
- echo "TODO tear down $STAGING_SUBDOMAIN"
- helm del --purge $STAGING_SUBDOMAIN
when: manual
only:
variables:
- $CI_COMMIT_MESSAGE =~ /-subdomain/
environment:
name: staging
except:
refs:
- master
- test/gitlab-ci
deploy:fpm:
stage: deploy
image: docker:latest
image: minds/ci:latest
script:
- apk add --no-cache curl jq python py-pip
- pip install awscli
- docker build -t $REPOSITORY_URL_FPM -f containers/php-fpm/Dockerfile .
- $(aws ecr get-login --no-include-email --region us-east-1)
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF $REPOSITORY_URL_FPM
- docker push $REPOSITORY_URL_FPM
- aws ecs update-service --service=$SERVICE_FPM --force-new-deployment --region us-east-1 --cluster=$CLUSTER
only:
......@@ -54,12 +114,12 @@ deploy:fpm:
deploy:runners:
stage: deploy
image: docker:latest
image: minds/ci:latest
script:
- apk add --no-cache curl jq python py-pip
- pip install awscli
- docker build -t $REPOSITORY_URL_RUNNERS -f containers/php-runners/Dockerfile .
- $(aws ecr get-login --no-include-email --region us-east-1)
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF
- docker tag $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF $REPOSITORY_URL_RUNNERS
- docker push $REPOSITORY_URL_RUNNERS
- aws ecs update-service --service=$SERVICE_RUNNERS --force-new-deployment --region us-east-1 --cluster=$CLUSTER
only:
......@@ -67,4 +127,4 @@ deploy:runners:
- master
- test/gitlab-ci
environment:
name: production
\ No newline at end of file
name: production
......@@ -91,9 +91,13 @@ class Install extends Cli\Controller implements Interfaces\CliControllerInterfac
$provisioner->setupSite();
$this->out('OK');
$this->out('- Setting up administrative user (ignore warnings, if any):', $this::OUTPUT_INLINE);
$provisioner->setupFirstAdmin();
$this->out('OK');
try {
$this->out('- Setting up administrative user (ignore warnings, if any):', $this::OUTPUT_INLINE);
$provisioner->setupFirstAdmin();
$this->out('OK');
} catch (\Exception $ex) {
$this->out('Could not setup initial user');
}
}
$this->out(['Done!', 'Open your browser and go to ' . $provisioner->getSiteUrl()], $this::OUTPUT_PRE);
......
......@@ -13,10 +13,6 @@ ADD --chown=www-data . /var/www/Minds/engine
RUN rm -f /var/www/Minds/engine/settings.php
# Install awscli
RUN apk update && apk add --no-cache py-pip && pip install --upgrade pip && pip install awscli
# Copy secrets script
COPY containers/php-fpm/pull-secrets.sh pull-secrets.sh
......
......@@ -8,10 +8,6 @@ ADD --chown=www-data . /var/www/Minds/engine
RUN rm -f /var/www/Minds/engine/settings.php
# Install awscli
RUN apk update && apk add --no-cache py-pip && pip install --upgrade pip && pip install awscli
# Setup our supervisor service
RUN apk add --no-cache \
......
......@@ -8,10 +8,6 @@ ADD --chown=www-data . /var/www/Minds/engine
RUN rm -f /var/www/Minds/engine/settings.php
# Install awscli
RUN apk update && apk add --no-cache py-pip && pip install --upgrade pip && pip install awscli
# Setup our supervisor service
RUN apk add --no-cache \
......
......@@ -84,6 +84,10 @@ RUN apk add --update --no-cache nodejs
RUN apk add --no-cache ffmpeg
# Install awscli
RUN apk update && apk add --no-cache py-pip && pip install --upgrade pip && pip install awscli
# PHP INI
COPY php.ini /usr/local/etc/php/
......
......@@ -8,10 +8,6 @@ ADD --chown=www-data . /var/www/Minds/engine
RUN rm -f /var/www/Minds/engine/settings.php
# Install awscli
RUN apk update && apk add --no-cache py-pip && pip install --upgrade pip && pip install awscli
# Setup our supervisor service
RUN apk add --no-cache \
......