-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
73 lines (64 loc) · 1.55 KB
/
Taskfile.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
version: '3'
vars:
CONTAINER: 'alafi-postgres'
VOLUME: 'pgdata'
env:
ALAFI_CONFIG_FILE_PATH: .config.yaml
tasks:
postgres:start:
desc: Starts the Postgres container
cmds:
- docker run --name {{.CONTAINER}}
-p 5432:5432
-v {{.VOLUME}}:/var/lib/postgresql/data
-e POSTGRES_PASSWORD=password
-d postgres
- while ! docker exec {{.CONTAINER}} pg_isready -U postgres; do sleep 1; done
status:
- docker ps | grep {{.CONTAINER}}
postgres:stop:
desc: Stops the Postgres container
cmds:
- docker stop {{.CONTAINER}}
- docker rm {{.CONTAINER}}
postgres:clean:
desc: Remove the Postgres volume
cmds:
- docker volume rm {{.VOLUME}}
shell:
desc: Opens the Django shell
deps:
- postgres:start
cmds:
- ./manage.py shell -i ipython
serve:
desc: Runs the server
deps:
- postgres:start
cmds:
- ./manage.py migrate
- ./manage.py runserver
settle:
desc: Run transactions settler
deps:
- postgres:start
cmds:
- ./manage.py run_transaction_settler
test:
desc: Runs the tests
cmds:
- task: postgres:start
vars:
CONTAINER: 'alafi-postgres-test'
VOLUME: 'pgdata-test'
- defer:
task: postgres:stop
vars:
CONTAINER: 'alafi-postgres-test'
VOLUME: 'pgdata-test'
- defer:
task: postgres:clean
vars:
CONTAINER: 'alafi-postgres-test'
VOLUME: 'pgdata-test'
- ./manage.py test