forked from evo-company/featureflags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpi.yaml
192 lines (173 loc) · 5.17 KB
/
pi.yaml
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
- !Image
name: env
from: !DockerImage python:3.7.3-slim
repository: registry.evo.dev/service/featureflags/py-env
tasks:
- run: apt-get update
- run: apt-get install -y build-essential
- run: pip3 install --no-cache-dir --no-deps --disable-pip-version-check -r {{req}}
req: !File server/setup.txt
- run: apt-get purge -y build-essential
- run: apt-get autoremove -y
- run: rm -rf /var/lib/apt/lists/*
- run: cp {{bin}} /usr/local/bin/grpc_health_probe && chmod +x /usr/local/bin/grpc_health_probe
bin: !Download "https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.2.0/grpc_health_probe-linux-amd64"
- !Image
name: node
from: !DockerImage node:12.4.0-alpine
repository: registry.evo.dev/service/featureflags/js-env
tasks:
- run: cp {{pkg}} /package.json
pkg: !File "package.json"
- run: cp {{lock}} /package-lock.json
lock: !File "package-lock.json"
- run: npm ci
- !Image
name: app
from: env
repository: registry.evo.dev/service/featureflags/server
tasks:
- run: pip3 install --no-deps {{src}}
src: !Bundle "server"
- run: cp {{exe}} /tini
exe: !Download "https://github.com/krallin/tini/releases/download/v0.18.0/tini"
- run: chmod +x /tini
- run: cp {{ver}} /checksum.txt
ver: !File "checksum.txt"
- !Image
name: test
from: env
repository: registry.evo.dev/service/featureflags/py-test
tasks:
- run: pip3 install --no-cache-dir --no-deps --disable-pip-version-check -r {{req}}
req: !File requirements-tests.txt
- !Image
name: docs
from: env
repository: registry.evo.dev/service/featureflags/py-doc
tasks:
- run: pip3 install --no-cache-dir --no-deps --disable-pip-version-check -r {{req}}
req: !File requirements-docs.txt
- !Image
name: protoc
from: env
repository: localhost/featureflags/protoc
tasks:
- run: pip3 install --no-cache-dir --no-deps grpcio-tools==1.18.0
- !Service
name: pg
network-name: postgres
image: !DockerImage timescale/timescaledb:0.9.1-pg10
ports:
- !Expose { port: 5432, as: 5432, addr: 0.0.0.0 }
- !Command
name: pg init
description: Run PostgreSQL console
image: !DockerImage postgres:10.1-alpine
run: psql -U postgres -h postgres -c "CREATE DATABASE {{database}}"
params:
- !Argument {name: database, default: featureflags}
- !Command
name: psql
description: init posgres database
image: !DockerImage postgres:10.1-alpine
run: psql -U postgres -h postgres {{database}}
params:
- !Argument {name: database, default: featureflags}
- !Command
name: test
description: Run py.test
image: test
params:
- !Argument {name: tests, default: ''}
run: py.test {{tests}}
environ:
LANG: C.UTF-8
LC_ALL: C.UTF-8
PYTHONIOENCODING: UTF-8
PYTHONPATH: server:client
- !Command
name: migration generate
description: Autogenerate migration
image: env
params:
- !Argument {name: message}
run: python3 -m featureflags.server config.yaml@local alembic -- revision --autogenerate -m {{message}}
environ:
LANG: C.UTF-8
LC_ALL: C.UTF-8
PYTHONIOENCODING: UTF-8
PYTHONPATH: server
- !Command
name: migration proceed
description: Apply migrations
image: env
run: python3 -m featureflags.server config.yaml@local alembic -- upgrade head
environ:
LANG: C.UTF-8
LC_ALL: C.UTF-8
PYTHONIOENCODING: UTF-8
PYTHONPATH: server
- !Command
name: web
description: Run Web application
image: env
requires: [pg]
run: python3 -m featureflags.server config.yaml@local web --port 8000 --prometheus-port=9000
environ:
LANG: C.UTF-8
LC_ALL: C.UTF-8
PYTHONIOENCODING: UTF-8
PYTHONPATH: server
ports:
- !Expose {port: 8000, as: 8000, addr: 0.0.0.0}
- !Expose {port: 9000, as: 9000, addr: 0.0.0.0}
- !Command
name: rpc
network-name: grpc.featureflags.svc
description: Run gRPC server
image: env
requires: [pg]
run: python3 -m featureflags.server config.yaml@local rpc --port 50051
environ:
LANG: C.UTF-8
LC_ALL: C.UTF-8
PYTHONIOENCODING: UTF-8
PYTHONPATH: server
- !Command
name: examples sanic-app
description: Run example app with Sanic and AsyncIOManager
image: env
run: python3 examples/sanic_app.py
environ:
LANG: C.UTF-8
LC_ALL: C.UTF-8
PYTHONIOENCODING: UTF-8
PYTHONPATH: client
ports:
- !Expose {port: 5000, as: 5000, addr: 0.0.0.0}
- !Command
name: build docs
image: docs
run: sphinx-build -a -b html docs public
environ:
PYTHONPATH: client:server:protobuf
- !Command
name: webpack build
image: node
run: /node_modules/.bin/webpack --config webpack.prod.js
- !Command
name: webpack watch
image: node
run: /node_modules/.bin/webpack --config webpack.dev.js --watch
- !Command
name: build proto
image: protoc
run: |
python3 -m grpc_tools.protoc -Iprotobuf --python_out=protobuf protobuf/featureflags/protobuf/backend.proto
python3 -m grpc_tools.protoc -Iprotobuf --python_out=protobuf protobuf/featureflags/protobuf/graph.proto
python3 -m grpc_tools.protoc -Iprotobuf --python_out=protobuf --python_grpc_out=protobuf --grpc_python_out=protobuf protobuf/featureflags/protobuf/service.proto
- !Command
name: health-check rpc
image: env
run: grpc_health_probe -addr grpc.featureflags.svc:50051