Skip to content

Commit

Permalink
publish 'spryker' harness
Browse files Browse the repository at this point in the history
  • Loading branch information
kierenevans committed Sep 30, 2020
1 parent 3a4da0c commit 49e5998
Show file tree
Hide file tree
Showing 147 changed files with 5,087 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _twig/docker-compose.yml/service/blackfire.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
blackfire:
image: {{ @('services.blackfire.image') }}
labels:
- traefik.enable=false
environment: {{ to_nice_yaml(deep_merge([
@('services.blackfire.environment'),
@('services.blackfire.environment_secrets')
]), 2, 6) | raw }}
networks:
- private
7 changes: 7 additions & 0 deletions _twig/docker-compose.yml/service/chrome.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
chrome:
image: yukinying/chrome-headless-browser:latest
command: ["--no-sandbox", "--disable-gpu", "--headless", "--disable-dev-shm-usage", "--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222", "--user-data-dir=/data"]
labels:
- traefik.enable=false
networks:
- private
22 changes: 22 additions & 0 deletions _twig/docker-compose.yml/service/cron.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cron:
build:
context: ./
dockerfile: .my127ws/docker/image/cron/Dockerfile
{% if @('app.build') == 'dynamic' %}
volumes:
- {{ (syncvolume) ? @('workspace.name') ~ '-sync:/app:nocopy' : ('./:/app' ~ @('docker.compose.host_volume_options')) }}
- ./.my127ws/application:/home/build/application
{% else %}
image: {{ @('services.cron.image') }}
{% endif %}
environment: {{ to_nice_yaml(deep_merge([
@('services.php-base.environment'),
@('services.cron.environment'),
@('services.php-base.environment_secrets'),
@('services.cron.environment_secrets')
]), 2, 6) | raw }}
{% include blocks ~ 'environment.yml.twig' %}
networks:
- private
labels:
- traefik.enable=false
14 changes: 14 additions & 0 deletions _twig/docker-compose.yml/service/elasticsearch.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
elasticsearch:
image: {{ @('services.elasticsearch.image') }}
labels:
- traefik.enable=false
environment:
ES_JAVA_OPTS: -Xms512m -Xmx512m
discovery.type: single-node
networks:
- private
{% if @('app.build') != 'static' and @('docker.port_forward.enabled') %}
ports:
- "127.0.0.1:0:9200"
- "127.0.0.1:0:9300"
{% endif %}
6 changes: 6 additions & 0 deletions _twig/docker-compose.yml/service/memcached.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
memcached:
image: {{ @('services.memcached.image') }}
labels:
- traefik.enable=false
networks:
- private
21 changes: 21 additions & 0 deletions _twig/docker-compose.yml/service/mysql.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% set command = [] %}
{% for var,value in @('database.var') -%}
{% set command = command|merge(['--' ~ var ~ '=' ~ value]) %}
{% endfor %}
mysql:
image: {{ @('services.mysql.image') }}
labels:
- traefik.enable=false
{% if command|length %}
command: {{ command|join(' ') }}
{% endif %}
environment: {{ to_nice_yaml(deep_merge([
@('services.mysql.environment'),
@('services.mysql.environment_secrets')
]), 2, 6) | raw }}
networks:
- private
{% if @('app.build') != 'static' and @('docker.port_forward.enabled') %}
ports:
- "127.0.0.1:{{ @('database.port_forward') ? @('database.port_forward') : '0' }}:3306"
{% endif %}
12 changes: 12 additions & 0 deletions _twig/docker-compose.yml/service/php-fpm-exporter.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
php-fpm-exporter:
image: {{ @('services.php-fpm-exporter.image') }}
environment: {{ to_nice_yaml(deep_merge([
@('services.php-fpm-exporter.environment'),
@('services.php-fpm-exporter.environment_secrets')
]), 2, 6) | raw }}
labels:
- traefik.enable=false
depends_on:
- php-fpm
networks:
- private
14 changes: 14 additions & 0 deletions _twig/docker-compose.yml/service/postgres.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
postgres:
image: {{ @('services.postgres.image') }}
labels:
- traefik.enable=false
environment: {{ to_nice_yaml(deep_merge([
@('services.postgres.environment'),
@('services.postgres.environment_secrets')
]), 2, 6) | raw }}
networks:
- private
{% if @('app.build') != 'static' and @('docker.port_forward.enabled') %}
ports:
- "127.0.0.1:{{ @('database.port_forward') ? @('database.port_forward') : '0' }}:5432"
{% endif %}
16 changes: 16 additions & 0 deletions _twig/docker-compose.yml/service/rabbitmq.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rabbitmq:
image: {{ @('services.rabbitmq.image') }}
environment: {{ to_nice_yaml(deep_merge([
@('services.rabbitmq.environment'),
@('services.rabbitmq.environment_secrets')
]), 2, 6) | raw }}
networks:
- private
- shared
labels:
- traefik.backend={{ @('rabbitmq.host') }}-{{ @('workspace.name') }}
- traefik.frontend.rule=Host:{{ @('rabbitmq.external_host') }}
- traefik.docker.network=my127ws
- traefik.port={{ @('rabbitmq.api_port') }}
- co.elastic.logs/module=rabbitmq
- co.elastic.metrics/module=rabbitmq
8 changes: 8 additions & 0 deletions _twig/docker-compose.yml/service/redis-session.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
redis-session:
image: {{ @('services.redis_session.image') }}
# 1GB; evict key that would expire soonest
command: redis-server --maxmemory 1073742000 --maxmemory-policy volatile-ttl --save 3600 1 --save 300 100 --save 60 10000
labels:
- traefik.enable=false
networks:
- private
8 changes: 8 additions & 0 deletions _twig/docker-compose.yml/service/redis.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
redis:
image: {{ @('services.redis.image') }}
# 1GB; evict any least recently used key even if they don't have a TTL
command: redis-server --maxmemory 1073742000 --maxmemory-policy allkeys-lru --save 3600 1 --save 300 100 --save 60 10000
labels:
- traefik.enable=false
networks:
- private
11 changes: 11 additions & 0 deletions _twig/docker-compose.yml/service/tideways.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tideways:
build:
context: .my127ws/docker/image/tideways/
labels:
- traefik.enable=false
environment: {{ to_nice_yaml(deep_merge([
@('services.tideways.environment'),
@('services.tideways.environment_secrets')
]), 2, 6) | raw }}
networks:
- private
49 changes: 49 additions & 0 deletions _twig/docker-compose.yml/service/varnish.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% if 'varnish' in @('app.services') %}
{% set hostnames = [@('hostname')] %}
{% set hostnames = hostnames|merge(@('hostname_aliases')|map(alias => "#{alias}." ~ @('domain'))) %}
varnish:
image: {{ @('services.varnish.image') }}
labels:
- traefik.backend={{ @('workspace.name') }}
- traefik.frontend.rule=Host:{{ hostnames|join(',') }}
- traefik.docker.network=my127ws
- traefik.port=80
environment: {{ to_nice_yaml(deep_merge([
@('services.varnish.environment'),
@('services.varnish.environment_secrets')
]), 2, 6) | raw }}
links:
- nginx:nginx
volumes:
- .my127ws/docker/image/varnish/root/etc/varnish/default.vcl:/etc/varnish/default.vcl:ro
- type: tmpfs
target: /var/lib/varnish:exec
tmpfs:
size: "100000"
networks:
private:
aliases:
- varnish-0.varnish-headless
{% if @('replicas.varnish') > 1 %}
{% for instanceNumber in 1..(@('replicas.varnish')-1) %}
- varnish-{{ instanceNumber }}.varnish-headless
{% endfor %}
{% endif %}
shared: {}

# Provide TLS offloading for integration tests via varnish
tls-offload:
build:
context: .my127ws/docker/image/tls-offload/
labels:
- traefik.enable=false
links:
- varnish:varnish
networks:
private:
aliases:
{% for alias in hostnames %}
- {{ alias }}
{% endfor %}
shared: {}
{% endif %}
8 changes: 8 additions & 0 deletions application/overlay/.dockerignore.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% set build = @('app.build') %}
{% set blocks = 'application/overlay/_twig/.dockerignore/' %}

{% if build == 'dynamic' %}
{% include blocks ~ 'dynamic.twig' %}
{% else %}
{% include blocks ~ 'static.twig' %}
{% endif %}
93 changes: 93 additions & 0 deletions application/overlay/Jenkinsfile.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
pipeline {
agent { label "my127ws" }
environment {
MY127WS_KEY = credentials('{{ @('jenkins.credentials.my127ws_key') }}')
MY127WS_ENV = "pipeline"
}
triggers { cron(env.BRANCH_NAME == '{{ @('git.default_branch') }}' ? 'H H(0-6) * * *' : '') }
stages {
stage('Build') {
steps {
sh 'ws install'
milestone(10)
}
}
stage('Checks without development dependencies') {
steps {
sh 'ws exec composer test-production-quality'
sh 'ws exec app composer:development_dependencies'
milestone(20)
}
}
stage('Test') {
parallel {
stage('quality') { steps { sh 'ws exec composer test-quality' } }
stage('unit') { steps { sh 'ws exec composer test-unit' } }
stage('acceptance') { steps { sh 'ws exec composer test-acceptance' } }
stage('helm kubeval qa') { steps { sh 'ws helm kubeval qa' } }
}
}
{% if @('pipeline.publish.enabled') == 'yes' %}
stage('Publish') {
{% if @('pipeline.publish.environment') %}
environment {
{% for key, value in @('pipeline.publish.environment') %}
{{ key }} = {{ value }}
{% endfor %}
}
{% endif %}
when {
not { triggeredBy 'TimerTrigger' }
anyOf {
{% for branch in @('pipeline.publish.branches') %}
branch '{{ branch }}'
{% endfor %}
{% if @('pipeline.qa.enabled') == 'yes' %}
branch '{{ @('pipeline.qa.branch') }}'
{% endif %}
{% if @('pipeline.preview.enabled') == 'yes' %}
{% for branch in @('pipeline.preview.target_branches') %}
changeRequest target: '{{ branch }}'
{% endfor %}
{% endif %}
}
}
steps {
milestone(50)
sh 'ws app publish'
{% if @('pipeline.publish.chart.enabled') %}
sh 'ws app publish chart "${GIT_BRANCH}" "{{ @('workspace.name') }} build artifact ${GIT_COMMIT}"'
{% endif %}
}
}
{% endif %}
{% if @('pipeline.qa.enabled') == 'yes' %}
stage('Deploy (QA)') {
{% if @('pipeline.qa.environment') %}
environment {
{% for key, value in @('pipeline.qa.environment') %}
{{ key }} = {{ value }}
{% endfor %}
}
{% endif %}
when {
not { triggeredBy 'TimerTrigger' }
branch '{{ @('pipeline.qa.branch') }}'
}
steps {
milestone(100)
lock(resource: '{{ @('workspace.name') }}-qa-deploy', inversePrecedence: true) {
milestone(101)
sh 'ws app deploy qa'
}
}
}
{% endif %}
}
post {
always {
sh 'ws destroy'
cleanWs()
}
}
}
2 changes: 2 additions & 0 deletions application/overlay/_twig/.dockerignore/dynamic.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.my127ws
1 change: 1 addition & 0 deletions application/overlay/_twig/.dockerignore/static.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# no need for exclusions for now
15 changes: 15 additions & 0 deletions application/overlay/auth.json.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"http-basic": {
{% for repo in @('composer.auth.basic') %}
"{{ repo.path }}": {
"username": "{{ repo.username }}",
"password": "{{ repo.password }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
},
"github-oauth": {
{% if @('composer.auth.github') %}
"github.com": "{{ @('composer.auth.github') }}"
{% endif %}
}
}
Loading

0 comments on commit 49e5998

Please sign in to comment.