contrib/systemd: Add systemd build and deploy example

* docs: Compile bootcfg from source, start a systemd unit
* Install bootcfg static binary to /usr/local/bin
* Add default configs /etc/bootcfg.conf and /etc/bootcfg
This commit is contained in:
Dalton Hubble
2016-03-14 02:21:34 -07:00
parent b4c33bac91
commit e5641d9535
5 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
# Deployment
## Binary
Clone the coreos-baremetal project into your $GOPATH.
go get github.com/coreos/coreos-baremetal
cd $GOPATH/src/github.com/coreos/coreos-baremetal
Build `bootcfg` from source.
make
Install the `bootcfg` static binary to `/usr/local/bin`.
$ sudo make install
Run `bootcfg`
$ sudo bootcfg -version
$ sudo bootcfg -address 0.0.0.0:8080
main: starting bootcfg HTTP server on 0.0.0.0:8080
See [flags and variables](config.md).
### systemd
Add and start bootcfg's example systemd unit.
sudo cp contrib/systemd/bootcfg.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start bootcfg.service
Check the logs with `journalctl`.
journalctl -u bootcfg.service
Enable the `bootcfg` service if you'd like it to start at boot time.
sudo systemctl enable bootcfg.service
### Uninstall
sudo systemctl stop bootcfg.service
sudo make uninstall

40
Makefile Normal file
View File

@@ -0,0 +1,40 @@
BIN_DIR=/usr/local/bin
CONF_DIR=/etc/bootcfg
VAR_DIR=/var/bootcfg
CONF_FILE=/etc/bootcfg.conf
ENV_FILE=/etc/bootcfg.env
all: build
build:
./build
test:
./test
install:
cp bin/bootcfg $(BIN_DIR)
cp -n examples/default.yaml $(CONF_FILE)
touch $(ENV_FILE)
mkdir -p $(CONF_DIR)/{profiles,ignition,cloud}
mkdir -p $(VAR_DIR)
cp -n -R examples/profiles $(CONF_DIR)
cp -n -R examples/ignition $(CONF_DIR)
cp -n -R examples/cloud $(CONF_DIR)
@echo "*****************"
@echo "bootcfg INSTALLED"
@echo "*****************"
@echo "bootcfg was installed to /usr/local/bin/bootcfg"
@echo "The config file is located at /etc/bootcfg.conf"
@echo "The environment file is located at /etc/bootcfg.env"
uninstall:
rm $(BIN_DIR)/bootcfg
rm $(CONF_FILE)
rm $(ENV_FILE)
rm -rf $(CONF_DIR)
rm -rf $(VAR_DIR)
.PHONY: build

View File

@@ -23,6 +23,8 @@ CoreOS on Baremetal contains guides for network booting and configuring CoreOS c
* [OpenPGP Signing](Documentation/openpgp.md)
* [Flags](Documentation/config.md)
* [API](Documentation/api.md)
* Deployment
* [systemd](Documentation/deployment.md#systemd)
* [Troubleshooting](Documentation/troubleshooting.md)
* [Hacking](Documentation/dev/develop.md)

View File

@@ -0,0 +1,11 @@
[Unit]
Description=CoreOS bootcfg Server
Documentation=https://github.com/coreos/coreos-baremetal
[Service]
Type=simple
EnvironmentFile=/etc/bootcfg.env
ExecStart=/usr/local/bin/bootcfg -address=0.0.0.0:8080 -log-level=debug
[Install]
WantedBy=multi-user.target

6
examples/default.yaml Normal file
View File

@@ -0,0 +1,6 @@
---
api_version: v1alpha1
groups:
- name: PXE Boot to CoreOS
profile: pxe
metadata: