1
我試圖創建谷歌雲coreos實例,它似乎被忽略了我的雲配置Gcloud CoreOs雲配置不具有效力
這裏是我建立gcloud coreos實例終端命令。
gcloud compute instances create gfb-core-1 --zone europe-west1-b --machine-type n1-standard-1 --metadata-from-file user-data=conductor/coreos/cloud-config-gcloud.ym
我下面有一個我的雲配置示例。
#cloud-config
coreos:
units:
- name: sample.service
command: start
enable: true
content: |
[Unit]
Description=Sample Service.
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStart=/opt/bin/docker-compose start;
ExecStop=/opt/bin/docker-compose stop;
[Install]
WantedBy=multi-user.target
- name: backup.service
enable: true
content: |
[Unit]
Description=Sample BackUp Script
[Service]
Type=oneshot
ExecStart=/usr/bin/docker exec db-live /backup-db.sh
- name: backup.timer
command: start
enable: true
content: |
[Unit]
Description=Runs Sample BackUp twice a day
[Timer]
OnCalendar=*-*-* 0/12:00:00
# References for timers https://www.freedesktop.org/software/systemd/man/systemd.time.html# units:
- name: media-backup.mount
command: start
enable: true
content: |
[Mount]
What=/dev/disk/by-id/google-core-disk-1
Where=/app
Type=ext3
write_files:
- path: /etc/environment
permissions: 420
content: |
COMPOSE_FILE=/path/to/app/docker-compose.yml
- path: /home/core/.bashrc
permissions: 420
owner: core:core
content: |
# source <(sudo cat /etc/environment)
eval $(sudo cat /etc/environment | sed 's/^/export /')