【问题标题】:Gcloud CoreOs Cloud Config not having effectGcloud CoreOs Cloud Config 没有效果
【发布时间】:2016-06-21 21:43:35
【问题描述】:

我正在尝试在谷歌云上创建一个 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 /')

【问题讨论】:

    标签: google-cloud-platform coreos


    【解决方案1】:

    Cloud-configs 对结构/层次结构使用缩进,并且您共享的文件的用途不正确。这是共享的拼写错误还是实际上是这样?

    试试https://coreos.com/validate/ 看看你的配置是否有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-04
      • 1970-01-01
      • 1970-01-01
      • 2019-03-23
      • 2018-08-01
      • 1970-01-01
      • 2016-02-18
      • 2016-09-26
      相关资源
      最近更新 更多