-
Notifications
You must be signed in to change notification settings - Fork 34
/
x.drone.yml
102 lines (91 loc) · 2.79 KB
/
x.drone.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
92
93
94
95
96
97
98
99
100
101
102
pipeline:
######################################################
# UNIT TESTS
# everything gets tested
# backend-unit-tests:
# group: test
# image: python:3.7
# environment:
# TILDE_SQL_HOST: postgres
# TILDE_SQL_PORT: 5432
# RABBITMQ_HOST: rabbitmq
# GIT_REAL_WEBHOOK_SECRET: supersecret
# commands:
# - cd backend
# - pip install --upgrade pip
# - pip install -r requirements.txt
# - python manage.py makemigrations
# - python manage.py test --failfast
# frontend-unit-tests:
# group: test
# image: node:12
# commands:
# - cd frontend
# - npm install
# - npm test
###########################################################
# DEPLOY TO STAGING
# only for develop and hotfix branches
frontend-deploy-staging:
image: google/cloud-sdk
volumes:
- /.secrets:/.secrets
secrets:
- source: REACT_APP_GOOGLE_CLIENT_ID_STAGING
target: REACT_APP_GOOGLE_CLIENT_ID
environment:
REACT_APP_API_BASE_URL: "https://backend.tilde.umuzi.org"
REACT_APP_FEATURE_AUTHENTICATION: 1
REACT_APP_FEATURE_BACKEND_API_ON: 1
GCLOUD_SERVICE_ACCOUNT_NAME: "drone-io-deploy@umuzi-prod.iam.gserviceaccount.com"
commands:
- ls /.secrets
- ls ./
- gcloud auth activate-service-account $${GCLOUD_SERVICE_ACCOUNT_NAME} --key-file=/.secrets/gcloud-service-key.json
- cd frontend
- yes | apt install nodejs npm
- npm install
- npm run build
- gcloud app deploy --appyaml app-staging.yaml
when:
branches: [develop, hotfix/*]
######################################################
# DEPLOY TO PROD
# only for master branch
# frontend-deploy-prod:
# group: deploy-prod
# image: google/cloud-sdk
# secrets:
# - source: REACT_APP_GOOGLE_CLIENT_ID_PROD
# target: REACT_APP_GOOGLE_CLIENT_ID
# environment:
# REACT_APP_API_BASE_URL: "https://backend.tilde.umuzi.org"
# REACT_APP_FEATURE_AUTHENTICATION: 1
# REACT_APP_FEATURE_BACKEND_API_ON: 1
# commands:
# - yes | apt install nodejs npm
# - cd frontend
# - npm install
# - npm run build
# - gcloud auth activate-service-account $${GCLOUD_SERVICE_ACCOUNT_NAME} --key-file=/path/key.json --project=umuzi-prod
# - gcloud app deploy --appyaml app-prod.yaml
# when:
# event: deployment
# environment: production
###########################################################
services:
postgres:
image: postgres:9.6
environment:
- POSTGRES_USER=pguser
- POSTGRES_PASSWORD=password
- POSTGRES_DB=db
rabbitmq:
image: rabbitmq:3-management
environment:
- RABBITMQ_DEFAULT_USER=rabbituser
- RABBITMQ_DEFAULT_PASS=password
volumes:
- name: secret_keys
host:
path: "/.secrets"