AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[cloud-config](server)

Martin Hope
gogstad
Asked: 2017-03-16 07:47:49 +0800 CST

Systemd 单位:[安装] 与命令:开始(云配置)

  • 1

我在 CoreOS 的云配置文件中配置 systemd。如果我理解正确的话,我有两种在启动时启动单元的方法:

备选方案 1,使用- 部分[Install](如数字海洋指南中所述):

- name: initialize_data
  content: |
    [Unit]
    Description=Run a command

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/mkdir /foo

    [Install]
    WantedBy=multi-user.target

备选方案 2,删除[Install]-section 并使用command: start:

- name: initialize_data
  command: start
  content: |
    [Unit]
    Description=Run a command

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/mkdir /foo

使用 启动设备有什么缺点command: start吗?我知道我无法控制它将在哪个单元之后启动,但还有什么?它会遵守和之[Unit]类的指令吗?Requires=After=

systemd cloud-config coreos
  • 1 个回答
  • 554 Views
Martin Hope
Derek Mahar
Asked: 2016-07-22 11:59:03 +0800 CST

cloud-config 脚本如何将文件复制到服务器?

  • 5

cloud-config脚本如何将文件复制到服务器? write_files需要脚本中的文件内容。如何指定包含内容的外部文件?

cloud-init cloud-config
  • 2 个回答
  • 8963 Views
Martin Hope
eric
Asked: 2016-06-08 14:44:19 +0800 CST

如何通过 cloud-config 配置 apache?

  • 0

我们有一个 cloud-config 脚本,可以在创建后立即在服务器上执行一些工作。(数字海洋水滴)

我希望脚本修改 apache 的默认行为,将 /var/www 目录的AllowOverride设置为All (默认值为 None)。

要手动执行此操作,我只需将 apache 配置文件 (/etc/apache2/apache2.conf) 更改为以下值。

<Directory /var/www/>
AllowOverride All

但是,我想以某种方式使用 cloud-config自动进行更改。

有一个更好的方法吗?

(注意:我不想使用write_files指令简单地用我们自己的自定义版本覆盖整个 apache2.conf 文件,因为担心与未来的 apache 版本不兼容)

apache-2.2 cloud-init cloud-config ubuntu-12.04
  • 1 个回答
  • 325 Views
Martin Hope
Hazim
Asked: 2016-06-02 00:20:52 +0800 CST

cloud-config 文件未加载,单元未在从 AMI 创建的机器上启动

  • 0

我们正在编写使用 terraform(在 AWS 上)执行以下操作的代码:

  1. 使用我们提供的 cloud-config yaml 文件创建一个 core-os 实例 (1)
  2. 从该实例创建 AMI

到目前为止,该过程运行良好。

当我们通过 AWS 控制台从该 AMI 启动实例 (2) 时。新启动的实例不使用 cloud-config 文件。

它 (2) 具有通过 cloud-config yaml 文件在实例 (1) 中创建的服务/系统单元。但是这些服务已经死了。如果我们明确地使用它们启动它们,它们工作得很好systemctl

我们如何确保从该 AMI 创建的任何实例都应该在启动时启动这些服务/系统单元,或者应该加载该云配置文件?

(我们也将 cloud-config yaml 保存在机器内部的某个位置,如果我们通过 手动运行 cloud-config 文件coreos-cloudinit --from-file=path/to/file/cloud-config.yaml,一切正常。但我们希望它在启动时无需任何手动步骤即可工作)

这是我们的云配置文件

#cloud-config
coreos:
  etcd2:
    # generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
    # specify the initial size of your cluster with ?size=X
    discovery: https://discovery.etcd.io/2cb27f1fecb57e14837016e04547aa32
    # multi-region and multi-cloud deployments need to use $public_ipv4
    advertise-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
    initial-advertise-peer-urls: http://127.0.0.1:2380
    # listen on both the official ports and the legacy ports
    # legacy ports can be omitted if your application doesn't depend on them
    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
    listen-peer-urls: http://0.0.0.0:2380,http://0.0.0.0:7001
  units:
    - name: etcd2.service
      command: start
    - name: fleet.service
      command: start
    - name: hello.service
      command: start
      content: |
        [Unit]
        Description=hello_docker
        After=docker.service
        Requires=docker.service

        [Service]
        TimeoutStartSec=0
        ExecStartPre=-/usr/bin/docker rm busybox1
        ExecStartPre=/usr/bin/docker pull busybox
        ExecStart=/usr/bin/docker run --rm --name busybox1 busybox /bin/sh -c "while true; do echo Hello Docker; sleep 1; done"
        ExecStop=/usr/bin/docker stop busybox1
amazon-web-services systemd cloud-config amazon-ami coreos
  • 2 个回答
  • 271 Views
Martin Hope
aknuds1
Asked: 2016-04-14 03:21:02 +0800 CST

如何确保 CoreOS 云配置服务能够下载文件?

  • 1

我在我的 CoreOS 云配置中定义了一次性服务,但由于无法从谷歌云存储(通过 wget)下载文件而失败:

4 月 13 日 11:09:56 staging-node-ys9y.c.experimentalberlin.internal sh[1132]:连接到 storage.googleapis.com|74.125.133.128|:443... 失败:连接超时。

我应该如何确保该服务能够从 Internet 下载文件?

我的云配置

#cloud-config
coreos:
  units:
    - name: bootstrap.service
      command: start
      content: |
        [Unit]
        Description=Bootstrap instance
        After=network-online.target
        Requires=network-online.target

        [Service]
        Type=oneshot
        RemainAfterExit=true
        ExecStart=/usr/bin/mkdir -p /tmp/kubernetes-staging
        ExecStart=cd /tmp/kubernetes-staging
        ExecStart=/bin/sh -c "cd /tmp/kubernetes-staging && wget https://storage.googleapis.com/experimentalberlin/staging.tar.gz && tar xf staging.tar.gz"
        ExecStart=/tmp/kubernetes-staging/worker/bootstrap.sh

        [Install]
        WantedBy=local.target
systemd wget cloud-config coreos
  • 1 个回答
  • 783 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve