forked from antonioperic/apiplatform-phpcon-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
91 lines (90 loc) · 4.1 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
language: php
jobs:
include:
- services:
- docker
addons:
apt:
packages:
- docker-ce
before_install:
- curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash -s -- --version v2.9.0
install: true
before_script:
- docker --version
- docker-compose --version
- sudo service postgresql stop
# wait for postgresql to shutdown
- while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done
script:
- if jq '.extra.symfony.id != null' api/composer.json -e > /dev/null; then echo 'composer.json must not have symfony.id' 1>&2 && false; fi
- docker-compose pull --ignore-pull-failures
- docker-compose build --pull
- docker-compose run --no-deps -T php composer validate --no-check-publish
- docker-compose up -d
- sleep 30
- docker-compose exec -T php composer req sensiolabs/security-checker
- docker-compose exec -T php bin/console security:check
- curl -f http://localhost # Client
- curl -f http://localhost:81 # Admin
- curl -f http://localhost:8080 # API
- curl -fk https://localhost # Client (HTTP/2)
- curl -fk https://localhost:444 # Admin (HTTP/2)
- curl -fk https://localhost:8443 # API (HTTP/2)
- helm lint ./api/helm/api/
before_deploy:
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin "$DOCKER_REGISTRY"
deploy:
provider: script
script: docker-compose push
skip_cleanup: true
on:
repo: api-platform/api-platform
branch: master
- env: >-
ADMIN_HOST=admin.127-0-0-1.sslip.io
ADMIN_IMAGE=quay.io/api-platform/admin
API_HOST=api.127-0-0-1.sslip.io
APP_SECRET=3c857494cfcc42c700dfb7a6
CLIENT_HOST=127-0-0-1.sslip.io,www.127-0-0-1.sslip.io
CLIENT_IMAGE=quay.io/api-platform/client
CORS_ALLOW_ORIGIN='^http://(?:\w+\.)?127-0-0-1\.sslip\.io$'
DATABASE_URL=postgres://api-platform:4e3bc2766fe81df300d56481@db/api
MERCURE_ALLOW_ANONYMOUS=0
MERCURE_CORS_ALLOWED_ORIGINS=http://127-0-0-1.sslip.io,http://admin.127-0-0-1.sslip.io
MERCURE_HOST=mercure.127-0-0-1.sslip.io
MERCURE_JWT_KEY=4121344212538417de3e2118
MERCURE_JWT_SECRET=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InN1YnNjcmliZSI6WyJmb28iLCJiYXIiXSwicHVibGlzaCI6WyJmb28iXX19.B0MuTRMPLrut4Nt3wxVvLtfWB_y189VEpWMlSmIQABQ
MERCURE_SUBSCRIBE_URL=http://mercure.127-0-0-1.sslip.io/hub
NGINX_IMAGE=quay.io/api-platform/nginx
PHP_IMAGE=quay.io/api-platform/php
POSTGRES_PASSWORD=4e3bc2766fe81df300d56481
REACT_APP_API_ENTRYPOINT=http://api.127-0-0-1.sslip.io
TRUSTED_HOSTS='^(?:localhost|api|api\.127-0-0-1\.sslip\.io)$'
VARNISH_IMAGE=quay.io/api-platform/varnish
services:
- docker
addons:
apt:
packages:
- docker-ce
before_install: true
install: true
before_script:
- docker --version
- docker-compose --version
- sudo service postgresql stop
# wait for postgresql to shutdown
- while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done
script:
- wget -O - https://github.com/api-platform/docker-compose-prod/archive/master.tar.gz | tar -xzf - && mv docker-compose-prod-master docker-compose-prod
- docker-compose -f docker-compose-prod/docker-compose.build.yml pull --ignore-pull-failures
- docker-compose -f docker-compose-prod/docker-compose.build.yml build --pull
- mkdir -p docker-compose-prod/docker/nginx-proxy/vhost.d
- echo 'return 301 http://127-0-0-1.sslip.io$request_uri;' > docker-compose-prod/docker/nginx-proxy/vhost.d/www.127-0-0-1.sslip.io
- docker-compose -f docker-compose-prod/docker-compose.yml up -d
- sleep 30
- curl -f http://127-0-0-1.sslip.io
- curl -f http://www.127-0-0-1.sslip.io
- curl -f http://admin.127-0-0-1.sslip.io
- curl -f http://api.127-0-0-1.sslip.io