-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile-podman.toml
197 lines (163 loc) · 4.96 KB
/
Makefile-podman.toml
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
193
194
195
196
197
################################################################################
## Utility tasks
################################################################################
[tasks.subcommand]
private = true
script = '''
#!@duckscript
cm_run_task ${SUBCOMMAND_PREFIX}_${1}
'''
[tasks.db]
private = false
extend = "subcommand"
env = { "SUBCOMMAND_PREFIX" = "db" }
[tasks.dev]
private = false
extend = "subcommand"
env = { "SUBCOMMAND_PREFIX" = "dev" }
[tasks.podman]
private = false
extend = "subcommand"
env = { "SUBCOMMAND_PREFIX" = "podman" }
################################################################################
## General/shorthand tasks
################################################################################
[tasks.daily]
dependencies = ["podman_up", "call_daily", "dev_sync_down"]
[tasks.call_daily]
private = true
dependencies = ["podman_up"]
script_runner = "@shell"
script = '''
podman-compose exec -u hexojp -w /home/hexojp/code/hexojp/ci hexojpdev cargo make daily
'''
[tasks.init]
dependencies = ["podman_up", "db_restore"]
[tasks.generate]
dependencies = ["dev_generate"]
[tasks.server]
dependencies = ["dev_server"]
################################################################################
## Podman tasks
################################################################################
[tasks.podman_down]
script_runner = "@shell"
script = '''
podman-compose down
podman volume rm hexojp_postgres
'''
[tasks.podman_up]
script_runner = "@shell"
script = '''
podman-compose up -d
'''
[tasks.podman_build]
script_runner = "@shell"
script = '''
podman-compose build
'''
[tasks.podman_build_nocache]
script_runner = "@shell"
script = '''
podman-compose build --no-cache
'''
[tasks.podman_stop]
script_runner = "@shell"
script = '''
podman-compose stop
'''
[tasks.podman_prune]
script_runner = "@shell"
script = '''
podman system prune
'''
[tasks.podman_prune_volumes]
script_runner = "@shell"
script = '''
podman system prune --volumes
'''
################################################################################
## DB tasks
################################################################################
[tasks.db_dump]
script_runner = "@shell"
script = '''
cd dockerfiles/db
rm *.tar.gz
pg_dump -h localhost -U hexojpadmin hexojp -F c -Z 9 -f hexojp.tar.gz
'''
[tasks.db_restore]
script_runner = "@shell"
script = '''
podman-compose exec -T -u postgres hexojpdb pg_restore -h localhost -U hexojpadmin -d hexojp -F c < dockerfiles/db/hexojp.tar.gz
'''
[tasks.db_logs]
script_runner = "@shell"
script = '''
podman-compose logs hexojpdb
'''
################################################################################
## Dev tasks
################################################################################
[tasks.dev_logs]
script_runner = "@shell"
script = '''
podman-compose logs hexojpdev
'''
[tasks.db_connect]
script_runner = "@shell"
script = '''
podman-compose exec --privileged -u root hexojpdb bash
'''
[tasks.dev_connect]
script_runner = "@shell"
script = '''
podman-compose exec --privileged -u hexojp hexojpdev sh
'''
[tasks.dev_connect_root]
script_runner = "@shell"
script = '''
podman-compose exec --privileged -u root hexojpdev sh
'''
[tasks.dev_sync_up]
script_runner = "@shell"
script = '''
podman cp dockerfiles/dev/ci hexojpdev:/home/hexojp/code/hexojp
podman cp dockerfiles/dev/db hexojpdev:/home/hexojp/code/hexojp
podman cp dockerfiles/dev/db/config.yaml hexojpdev:/home/hexojp/code/hexojp/db/config.yaml
podman cp dockerfiles/dev/_config.yml hexojpdev:/home/hexojp/code/hexojp/_config.yml
podman cp dockerfiles/dev/_config.landscape.yml hexojpdev:/home/hexojp/code/hexojp/_config.landscape.yml
podman cp dockerfiles/dev/scaffolds hexojpdev:/home/hexojp/code/hexojp
podman cp dockerfiles/dev/themes hexojpdev:/home/hexojp/code/hexojp
podman cp dockerfiles/dev/source hexojpdev:/home/hexojp/code/hexojp
podman cp hexojpdev:/home/hexojp/code/hexojp/db/config.yaml dockerfiles/dev/db/config.yaml
podman cp hexojpdev:/home/hexojp/code/hexojp/source dockerfiles/dev
'''
[tasks.dev_sync_down]
script_runner = "@shell"
script = '''
podman cp hexojpdev:/home/hexojp/code/hexojp/db/config.yaml dockerfiles/dev/db/config.yaml
podman cp hexojpdev:/home/hexojp/code/hexojp/source dockerfiles/dev
podman cp hexojpdev:/home/hexojp/code/hexojp/db.json dockerfiles/dev/db.json
'''
[tasks.dev_generate]
dependencies = ["dev_sync_up", "dev_fix_permissions"]
script_runner = "@shell"
script = '''
podman-compose exec -u hexojp -w /home/hexojp/code/hexojp/ci hexojpdev cargo make generate
'''
[tasks.dev_server]
script_runner = "@shell"
script = '''
podman-compose exec -u hexojp -w /home/hexojp/code/hexojp/ci hexojpdev cargo make server
'''
[tasks.dev_pacman_update]
script_runner = "@shell"
script = '''
podman-compose exec -u root --privileged -w /home/hexojp/code/hexojp/ci hexojpdev cargo make pacman_update
'''
[tasks.dev_fix_permissions]
script_runner = "@shell"
script = '''
podman-compose exec -u root --privileged hexojpdev chown -R hexojp:hexojp /home/hexojp/code/hexojp
'''