@@ -73,13 +73,14 @@ actions.
73
73
74
74
### Configuration
75
75
76
- Before using the CLI, configure the Supervisor base URL and API key by
76
+ Before using the CLI, configure the Supervisor base URI and API token by
77
77
creating a configuration file at ` ~/.supervisor ` :
78
78
79
79
``` yaml
80
80
---
81
- base_url : https://supervisor.example.com
82
- api_key : 8db7fde4-6a11-462e-ba27-6897b7c9281b
81
+ api :
82
+ uri : https://supervisor.example.com
83
+ token : 8db7fde4-6a11-462e-ba27-6897b7c9281b
83
84
` ` `
84
85
85
86
### Command Reference
@@ -96,6 +97,161 @@ supervisor is-healthy
96
97
97
98
Checks the health of the Supervisor service.
98
99
100
+ ### Deployment Management
101
+
102
+ The command ` deploy ` installs and sets up a containerized Supervisor service
103
+ on a vanilla Linux machine by provisioning the docker service and
104
+ deploying the application proxy [ Traefik] ( https://traefik.io/ ) .
105
+
106
+ #### Default Traefik docker command
107
+
108
+ ``` bash
109
+ docker run \
110
+ --detach --restart always --name traefik \
111
+ --volume /var/run/docker.sock:/var/run/docker.sock \
112
+ --volume /var/lib/traefik:/etc/traefik \
113
+ --network supervisor \
114
+ --publish 80:80 --publish 443:443 \
115
+ traefik:v3.2.1 \
116
+ --providers.docker.exposedbydefault=" false" \
117
+ --entrypoints.web.address=" :80" \
118
+ --entrypoints.websecure.address=" :443" \
119
+ --certificatesresolvers.letsencrypt.acme.email=" acme@supervisor.example" \
120
+ --certificatesresolvers.letsencrypt.acme.storage=" /etc/traefik/certs.d/acme.json" \
121
+ --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=" web"
122
+ ```
123
+
124
+ #### Default Supervisor docker command
125
+
126
+ ``` bash
127
+ docker run \
128
+ --detach --restart always --name supervisor \
129
+ --volume /var/run/docker.sock:/var/run/docker.sock \
130
+ --volume /var/lib/supervisor:/rails/storage \
131
+ --network supervisor \
132
+ --label traefik.enable=" true" \
133
+ --label traefik.http.routers.supervisor.tls=" true" \
134
+ --label traefik.http.routers.supervisor.tls.certresolver=" letsencrypt" \
135
+ --label traefik.http.routers.supervisor.rule=" Host(\" supervisor.example.com\" )" \
136
+ --label traefik.http.routers.supervisor.entrypoints=" websecure" \
137
+ --env SECRET_KEY_BASE=" 601f72235d8ea11db69e678f9...1a" \
138
+ --env SUPERVISOR_API_KEY=" 8db7fde4-6a11-462e-ba27-6897b7c9281b" \
139
+ ghcr.io/tschaefer/supervisor:main
140
+ ```
141
+
142
+ #### Default docker network command
143
+
144
+ ``` bash
145
+ docker network create \
146
+ --attachable true \
147
+ --ipv6=true \
148
+ --driver=bridge \
149
+ --opt com.docker.network.container_iface_prefix=supervisor
150
+ supervisor
151
+ ```
152
+
153
+ Prerequisites are super-user privileges, a valid DNS record for the
154
+ Supervisor service and the above mentioned configuration file.
155
+
156
+ While setup the necessary certificate is requested from
157
+ [ Let's Encrypt] ( https://letsencrypt.org/ ) via HTTP-challenge.
158
+
159
+
160
+ ``` bash
161
+ supervisor deploy --host root@machine.example.com
162
+ ```
163
+
164
+ The provisioning of docker can be skipped wit the option ` --skip-docker ` as
165
+ well as the installation of Traefik with the option ` --skip-traefik ` . For a
166
+ more informative output use ` --verbose ` - beware, sensible information will be
167
+ exposed.
168
+
169
+ The deployment is customizable by configuration in the root under ` deploy ` .
170
+
171
+ ``` yaml
172
+ deploy :
173
+
174
+ # Network settings
175
+ network :
176
+
177
+ # The name of the network to create, defaults to supervisor
178
+ name : supervisor
179
+ # Additional options to pass to the network create command
180
+ options :
181
+ ipv6 : false
182
+ opt : com.docker.network.driver.mtu=1500
183
+
184
+ # Traefik settings
185
+ traefik :
186
+
187
+ # The Traefik image to use, defaults to traefik:v3.2.1
188
+ image : traefik:v3.2.0
189
+
190
+ # Additional arguments to pass to the Traefik container
191
+ args :
192
+ configfile : /etc/traefik/traefik.yml
193
+
194
+ # Additional environment variables to pass to the Traefik container
195
+ env :
196
+ CF_API_EMAIL : cloudflare@example.com
197
+ CF_DNS_API_TOKEN : YSsfAH-d1q57j2D7T41ptAfM
198
+
199
+ # Supervisor settings
200
+ supervisor :
201
+
202
+ # The Supervisor image to use, defaults to ghcr.io/tschaefer/supervisor:main
203
+ image : ghcr.io/tschaefer/supervisor:latest
204
+
205
+ # Additional labels to apply to the Supervisor container
206
+ labels :
207
+ traefik.http.routers.supervisor.tls.certresolver : cloudflare
208
+
209
+ # Additional environment variables to pass to the Supervisor container
210
+ env : {}
211
+ ` ` `
212
+
213
+ Custom ` hooks` scripts can be run before and after certain deployment steps.
214
+
215
+ * `post-docker-setup`
216
+ * `pre-traefik-deploy`
217
+ * `post-traefik-deploy`
218
+ * `pre-supervisor-deploy`
219
+ * `post-supervisor-deploy`
220
+
221
+ **Example**:
222
+
223
+ ` ` ` bash
224
+ #!/usr/bin/env sh
225
+
226
+ # pre-traefik-deploy hook script
227
+
228
+ cat <<EOF> /var/lib/traefik/traefik.yml
229
+ ---
230
+ certificatesresolvers:
231
+ cloudflare:
232
+ acme:
233
+ email: acme@example.com
234
+ storage: /etc/traefik/certs.d/cloudflare.json
235
+ dnschallenge:
236
+ provider: cloudflare
237
+ EOF
238
+ ` ` `
239
+
240
+ The hook filename must be the hook name without any extension. The path to the
241
+ hooks directory can be configured in the root under `hooks`.
242
+
243
+ ` ` ` yaml
244
+ hooks: /path/to/hooks
245
+ ` ` `
246
+
247
+ The Supervisor service can be redeployed with the command `redeploy`.
248
+
249
+ ` ` ` bash
250
+ supervisor redeploy --host machine.example.com
251
+ ` ` `
252
+
253
+ Optionally, Traefik can be redeployed with the option `--with-traefik`.
254
+
99
255
# ## Stack Management
100
256
101
257
The `stacks` commands provide a variety of operations for managing stacks.
0 commit comments