gce: run mysql too. link it with camlistored.

I think I'm not using systemd correctly here. Things get very unhappy
if I reboot CoreOS: the Docker container named 'db' already exists, things keep
flapping up and down (not waiting for their dependencies), etc.

Maybe I need to register stop actions too.

Change-Id: I75ac3e965c03df4f7f3938ff13c66f137948bf4d
This commit is contained in:
Brad Fitzpatrick 2014-08-18 23:18:45 -07:00
parent 956e838cc0
commit c78e9af4b6
1 changed files with 21 additions and 2 deletions

View File

@ -103,16 +103,31 @@ coreos:
[Install]
WantedBy=sockets.target
- name: mysql.service
command: start
content: |
[Unit]
Description=MySQL
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/bin/docker run --name=db google/mysql
RestartSec=500ms
Restart=always
[Install]
WantedBy=multi-user.target
- name: camlistored.service
command: start
content: |
[Unit]
Description=Camlistore
After=docker.service
Requires=docker.service
Requires=docker.service mysql.service
[Service]
ExecStart=/usr/bin/docker run -p 80:80 -p 443:443 -v /run/camjournald.sock:/run/camjournald.sock -v /tmp/camlistore-tmp:/tmp camlistore/camlistored
ExecStart=/usr/bin/docker run -p 80:80 -p 443:443 -v /run/camjournald.sock:/run/camjournald.sock -v /tmp/camlistore-tmp:/tmp --link=db:mysqldb camlistore/camlistored
RestartSec=500ms
Restart=always
@ -120,6 +135,10 @@ coreos:
WantedBy=multi-user.target
`
const maxCloudConfig = 32 << 10 // per compute API docs
if len(cloudConfig) > maxCloudConfig {
log.Fatalf("cloud config length of %d bytes is over %d byte limit", len(cloudConfig), maxCloudConfig)
}
if *sshPub != "" {
key := strings.TrimSpace(readFile(*sshPub))
cloudConfig += fmt.Sprintf("\nssh_authorized_keys:\n - %s\n", key)