Skip to content

Commit

Permalink
Merge 8d1a917 into 63715ab
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSkierniewski committed Apr 25, 2017
2 parents 63715ab + 8d1a917 commit 430cb56
Show file tree
Hide file tree
Showing 33 changed files with 45,583 additions and 32,286 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.dockerignore
.env
.env.*
.eslintignore
.git
.gitattributes
.gitignore
Expand All @@ -14,7 +16,11 @@ ansible
backups
build
codeception.yml
composer.json
composer.lock
coverage
database/factories
database/seeds
develop
docker-compose.yml
Dockerfile
Expand All @@ -23,6 +29,8 @@ node_modules
package.json
phpunit.xml
README.md
resources/assets
scripts
server.php
tests
webpack.mix.js
18 changes: 12 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- vendor/
- node_modules/

test:
stage: test
Expand All @@ -25,6 +26,9 @@ test:
script:
- composer install --prefer-dist --no-interaction --no-suggest --no-progress
- "php vendor/bin/codecept run -c codeception.yml -o \"settings: lint: false\" --env platform"
- npm -s install
- npm -s run lint
- npm -s test -- --verbose

build:
stage: build
Expand All @@ -34,11 +38,13 @@ build:
- docker:1.12.5-dind
script:
- composer install --prefer-dist --no-interaction --no-dev --no-suggest --no-progress --optimize-autoloader
- npm -s install
- npm -s run production
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
- if [ -n "${CI_COMMIT_TAG}" ]; then docker build --pull -t registry.gitlab.com/grupazero/staging:${CI_COMMIT_TAG} .; fi
- if [ -n "${CI_COMMIT_TAG}" ]; then docker push registry.gitlab.com/grupazero/staging:${CI_COMMIT_TAG}; fi
- if [ -z "${CI_COMMIT_TAG}" ]; then docker build --pull -t registry.gitlab.com/grupazero/staging:latest .; fi
- if [ -z "${CI_COMMIT_TAG}" ]; then docker push registry.gitlab.com/grupazero/staging:latest; fi
- if [ -n "${CI_COMMIT_TAG}" ]; then docker build --pull -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} .; fi
- if [ -n "${CI_COMMIT_TAG}" ]; then docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}; fi
- if [ -z "${CI_COMMIT_TAG}" ]; then docker build --pull -t ${CI_REGISTRY_IMAGE}:latest .; fi
- if [ -z "${CI_COMMIT_TAG}" ]; then docker push ${CI_REGISTRY_IMAGE}:latest; fi
only:
- tags
- master
Expand All @@ -55,10 +61,10 @@ deploy to staging:
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
# TODO Validate if all env values are present
- "ansible-playbook -i ansible/staging
-e APP_KEY=$STAGING_APP_KEY
-e APP_VERSION=$CI_COMMIT_TAG
-e DOCKER_APP_IMAGE=$CI_REGISTRY_IMAGE
-e DOMAIN=$STAGING_DOMAIN
-e POSTGRES_USER=$STAGING_DB_USER
-e POSTGRES_PASSWORD=$STAGING_DB_PASSWORD
Expand Down Expand Up @@ -87,10 +93,10 @@ deploy to production:
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
# TODO Validate if all env values are present
- "ansible-playbook -i ansible/production
-e APP_KEY=$PRODUCTION_APP_KEY
-e APP_VERSION=$CI_COMMIT_TAG
-e DOCKER_APP_IMAGE=$CI_REGISTRY_IMAGE
-e DOMAIN=$PRODUCTION_DOMAIN
-e POSTGRES_USER=$PRODUCTION_DB_USER
-e POSTGRES_PASSWORD=$PRODUCTION_DB_PASSWORD
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ In Ubuntu hosts file should looks like the following:

```
# /etc/hosts
127.0.0.1 localhost
127.0.0.1 localhost
...
127.0.0.1 dev.gzero.pl
127.0.0.1 api.dev.gzero.pl
127.0.0.1 dev.gzero.pl
127.0.0.1 api.dev.gzero.pl
...
```

Expand Down
13 changes: 13 additions & 0 deletions ansible/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
---
- hosts: all
remote_user: root
pre_tasks:
- assert:
that:
- "APP_KEY is defined"
- "DOCKER_APP_IMAGE is defined"
- "DOMAIN is defined"
- "LETSENCRYPT_EMAIL is defined"
- "MAIL_PASSWORD is defined"
- "MAIL_USERNAME is defined"
- "POSTGRES_DATABASE is defined"
- "POSTGRES_PASSWORD is defined"
- "POSTGRES_PASSWORD is defined"
- "POSTGRES_USER is defined"
tasks:
- name: Create directories
file:
Expand Down
13 changes: 13 additions & 0 deletions ansible/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
---
- hosts: all
remote_user: root
pre_tasks:
- assert:
that:
- "APP_KEY is defined"
- "DOCKER_APP_IMAGE is defined"
- "DOMAIN is defined"
- "LETSENCRYPT_EMAIL is defined"
- "MAIL_PASSWORD is defined"
- "MAIL_USERNAME is defined"
- "POSTGRES_DATABASE is defined"
- "POSTGRES_PASSWORD is defined"
- "POSTGRES_PASSWORD is defined"
- "POSTGRES_USER is defined"
tasks:
- name: Check if local staging.htpasswd file exists
local_action: stat path="./staging.htpasswd"
Expand Down
7 changes: 4 additions & 3 deletions ansible/templates/env.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
APP_ENV=production
APP_VERSION={{ APP_VERSION | default('latest', true) }}
APP_KEY={{ APP_KEY }}
APP_DEBUG=false
APP_LOG_LEVEL=error
Expand Down Expand Up @@ -60,9 +61,9 @@ DISQUS_ENABLED={{ DISQUS_ENABLED }}
#}

FILE_SYSTEM={{ FILE_SYSTEM | default('local') }}
S3_KEY={{ S3_KEY }}
S3_SECRET={{ S3_SECRET }}
S3_KEY={{ S3_KEY | default('') }}
S3_SECRET={{ S3_SECRET | default('') }}
S3_REGION={{ S3_REGION | default('eu-central-1') }}
S3_BUCKET={{ S3_BUCKET }}
S3_BUCKET={{ S3_BUCKET | default('') }}

UPLOAD_DISK={{ UPLOAD_DISK | default('uploads') }}
2 changes: 1 addition & 1 deletion ansible/templates/production-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
networks:
- gznet
web_server:
image: registry.gitlab.com/grupazero/staging:{{ APP_VERSION | default('latest', true) }}
image: "{{ DOCKER_APP_IMAGE }}:{{ APP_VERSION | default('latest', true) }}"
restart: always
environment:
OVERRIDE_UMASK: "022"
Expand Down
2 changes: 1 addition & 1 deletion ansible/templates/staging-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
networks:
- gznet
web_server:
image: registry.gitlab.com/grupazero/staging:{{ APP_VERSION | default('latest', true) }}
image: "{{ DOCKER_APP_IMAGE }}:{{ APP_VERSION | default('latest', true) }}"
restart: always
environment:
OVERRIDE_UMASK: "022"
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 430cb56

Please sign in to comment.