File tree 6 files changed +100
-22
lines changed
6 files changed +100
-22
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# create managers servers in digital ocean with pre-set environment vars
5
5
# https://docs.docker.com/machine/drivers/digital-ocean/
6
+
7
+ # DO_TOKEN get the token from digitalocean.com (read/write)
8
+ # DO_SIZE pick your droplet size from "doctl compute size list"
9
+ # SSH_FINGERPRINT in the format of "8d:30:8a..." with a comand like "ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub"
10
+
6
11
for server in {1..3}; do
7
12
docker-machine create \
8
13
--driver=digitalocean \
9
14
--digitalocean-access-token=" ${DO_TOKEN} " \
10
15
--digitalocean-size=" ${DO_SIZE} " \
11
- --digitalocean-private-networking=true \
12
16
--digitalocean-ssh-key-fingerprint=" ${SSH_FINGERPRINT} " \
13
17
--digitalocean-tags=dogvscat \
18
+ --digitalocean-private-networking=true \
14
19
dvc${server} &
15
20
done
16
21
22
+
17
23
# if you wanted to create these locally in virtualbox, you might do this
18
24
# remember to check if you have enough RAM
19
25
# https://docs.docker.com/machine/drivers/virtualbox/
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
set -x
3
3
4
+ # since we created droplets with a private NIC on eth1, lets use that for swarm comms
5
+ LEADER_IP=$( docker-machine ssh dvc1 ifconfig eth1 | grep ' inet addr' | cut -d: -f2 | awk ' {print $1}' )
6
+
4
7
# create a swarm as all managers
5
- docker-machine ssh dvc1 docker swarm init --listen-addr=eth1 --data-path-addr=eth1 --advertise-addr=eth1
8
+ docker-machine ssh dvc1 docker swarm init --advertise-addr " $LEADER_IP "
9
+
10
+ # note that if you use eth1 above (private network in digitalocean) it makes the below
11
+ # a bit tricky, because docker-machine lists the public IP's but we need the
12
+ # private IP of manager for join commands, so we can't simply envvar the token
13
+ # like lots of scripts do... we'd need to fist get private IP of first node
14
+
15
+ # TODO: provide flexable numbers at cli for x managers and x workers
16
+ JOIN_TOKEN=$( docker-machine ssh dvc1 docker swarm join-token -q manager)
17
+
18
+ for i in 2 3; do
19
+ docker-machine ssh dvc$i docker swarm join --token " $JOIN_TOKEN " " $LEADER_IP " :2377
20
+ done
6
21
7
- docker-machine ssh dvc1 docker swarm join-token manager
22
+ docker-machine env dvc1
8
23
9
- # copy this command and add run it on other nodes
10
- # docker-machine ssh dvc2 <paste command>
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ version: '3.5'
3
3
services :
4
4
5
5
ghost :
6
- image : ghost:1- alpine
6
+ image : ghost:alpine
7
7
networks :
8
8
- proxy
9
9
- ghost
@@ -12,7 +12,7 @@ services:
12
12
database__client : mysql
13
13
database__connection__host : db
14
14
database__connection__user : root
15
- database__connection__password : YOURDBPASSWORDhere
15
+ database__connection__password : YOURDBPASSWORDhereee
16
16
database__connection__database : ghost
17
17
url : http://ghost.dogvs.cat
18
18
deploy :
@@ -31,7 +31,7 @@ services:
31
31
volumes :
32
32
- db:/var/lib/mysql
33
33
secrets :
34
- - db-password
34
+ - db-password2
35
35
networks :
36
36
- ghost
37
37
deploy :
Original file line number Diff line number Diff line change @@ -20,20 +20,23 @@ services:
20
20
- --docker.domain=traefik
21
21
- --docker.watch
22
22
- --api
23
- - --defaultentrypoints=http,https
24
- - --acme
25
-
26
- # TODO: envvar for email and default domain
27
- - --acme.httpchallenge
28
- - --acme.httpchallenge.entrypoint=http
29
- - --acme.onhostrule=true
30
- - --acme.entrypoint=https
31
- - --entryPoints=Name:https Address::443 TLS
32
- - --entryPoints=Name:http Address::80
33
- - --acme.storage=/etc/traefik/acme/acme.json
34
- - --acme.acmelogging
35
- - --acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
23
+ # - --defaultentrypoints=http,https
24
+ # - --acme
25
+
26
+ # # TODO: envvar for email and default domain
27
+ # - --acme.httpchallenge
28
+ # - --acme.httpchallenge.entrypoint=http
29
+ # - --acme.onhostrule=true
30
+ # - --acme.entrypoint=https
31
+ # - --entryPoints=Name:https Address::443 TLS
32
+ # - --entryPoints=Name:http Address::80
33
+ # - --acme.storage=/etc/traefik/acme/acme.json
34
+ # - --acme.acmelogging
35
+ # - --acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
36
36
# - --acme.caserver=https://acme-v02.api.letsencrypt.org/directory
37
+ deploy :
38
+ placement :
39
+ constraints : [node.role == manager]
37
40
logging :
38
41
options :
39
42
max-size : " 500k"
Original file line number Diff line number Diff line change 1
1
version : " 3.4"
2
2
3
+ # 1. WORKAROUND: would prefer this use null network driver, will use bride for now to avoid overlay
4
+ # 2. TODO: would prefer on-failure restart_policy, but need to run this in script to look
5
+ # for if plugin exists first before reinstalling
6
+ # 3. TODO: would prefer this picks a driver version, and support driver updates
7
+
3
8
services :
4
9
plugin-rexray :
5
10
image : mavenugo/swarm-exec:17.03.0-ce
11
+ networks :
12
+ - bridge
6
13
volumes :
7
14
- /var/run/docker.sock:/var/run/docker.sock
8
15
command : docker plugin install --grant-all-permissions rexray/dobs DOBS_REGION=nyc3 DOBS_TOKEN="${REXRAY_DO_TOKEN}" DOBS_CONVERTUNDERSCORES=true
@@ -15,4 +22,7 @@ services:
15
22
options :
16
23
max-size : " 500k"
17
24
18
-
25
+ networks :
26
+ bridge :
27
+ external : true
28
+ name : bridge
Original file line number Diff line number Diff line change
1
+ version : ' 3.5'
2
+
3
+ services :
4
+
5
+ ghost :
6
+ image : ghost:2-alpine
7
+ networks :
8
+ - proxy
9
+ - ghost
10
+ volumes :
11
+ - content:/var/lib/ghost/content
12
+ environment :
13
+ # see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
14
+ NODE_ENV : production
15
+ # database__client: mysql
16
+ # database__connection__host: db
17
+ # database__connection__user: root
18
+ # database__connection__password: YOURDBPASSWORDhereee
19
+ # database__connection__database: ghost
20
+ url : http://ghost.dogvs.cat
21
+ deploy :
22
+ replicas : 1
23
+ labels :
24
+ - traefik.port=2368
25
+ - traefik.docker.network=proxy
26
+ - traefik.frontend.rule=Host:ghost.dogvs.cat
27
+ # logging:
28
+ # driver: "gelf"
29
+ # options:
30
+ # gelf-address: "udp://127.0.0.1:5000"
31
+
32
+ # TODO: backup for static content
33
+
34
+
35
+ networks :
36
+ ghost : {}
37
+ proxy :
38
+ external : true
39
+
40
+ volumes :
41
+ content :
42
+ driver : rexray/dobs
43
+ driver_opts :
44
+ size : 1
45
+
46
+
You can’t perform that action at this time.
0 commit comments