4

I have deployed a CoreOS standealone server with VMware image follow this guide to experience CoreOS.

After deploy success, I found that my CoreOS only enable Docker service, without etcd and fleet service running. Although I know how to use systemd to run etcd and fleet service manually. And I also know use a proper cloud-config can install CoreOS in which etcd and fleet service start automatically.

But I want to know that:

  1. Is it possible to place a unit file in /etc/systemd/system to make systemd starts etcd service automatically?
  2. If can, what is the content of the unit file?
  3. If cannot, what is the other way?

Thanks

Yang Lifan
  • 445
  • 6
  • 15

2 Answers2

5
  1. Yes. You must have a an etcd.service and fleet.service with an Install section. I've added WantedBy=default.target in mine.

  2. They are already placed on coreos systems within /usr/lib64/systemd/system/. You can copy them to /etc/systemd/system/:

$ cp /usr/lib64/systemd/system/etcd.service /etc/systemd/system/
$ cp /usr/lib64/systemd/system/fleet.service /etc/systemd/system/
$ echo -e '[Install]\nWantedBy=default.target >> /etc/systemd/system/fleet.service
$ echo -e '[Install]\nWantedBy=default.target >> /etc/systemd/system/etcd.service
$ systemctl enable etcd.service
$ systemctl enable fleet.service

I'll also give you the general warning here that I have no idea what changes to /etc/systemd/ do in the long run, given CoreOSs upgrade system. An upgrade could wipe out /etc/systemd/ leaving you in a confused state as to what happened to your customized systemd scripts not managed by cloud-init.

Sheena Artrip
  • 1,990
  • 12
  • 16
  • 1
    While this will work, it's much better to follow best practices and use a cloud-config, particularly with CoreOS. And if you are using this in production, having a cloud-config to replicate these is very beneficial. – Christian Grabowski Jun 02 '15 at 14:25
2

The proper way to do this is with cloud-config. Specifically for VMware, you'll need to serve the cloud-config via config-drive as documented.

It's kind of a pain, but it'll work.

Rob
  • 2,426
  • 17
  • 11
  • Thanks. So is cloud-config the ONLY way to make services startup automatically? – Yang Lifan Nov 06 '14 at 04:16
  • Specifically, unit files are only way to start things automatically, but how you create them is up to you. You can provide them in your cloud-config under the units parameter. You can also place them on disk in /etc/systemd/system. – Rob Nov 07 '14 at 18:39