我正在尝试在google云上创建一个coreos实例,它似乎忽略了我的cloud-config
这是我用于设置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 /')
答案 0 :(得分:1)
Cloud-configs使用结构/层次结构的缩进,并且您共享的文件不正确。那是一个错误的共享还是实际上是这样?
尝试https://coreos.com/validate/查找您的配置是否有效。