diff --git a/Documentation/deployment.md b/Documentation/deployment.md new file mode 100644 index 00000000..c240c380 --- /dev/null +++ b/Documentation/deployment.md @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..38ce2fef --- /dev/null +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 25c32d76..637ab856 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/contrib/systemd/bootcfg.service b/contrib/systemd/bootcfg.service new file mode 100644 index 00000000..ccd84d1e --- /dev/null +++ b/contrib/systemd/bootcfg.service @@ -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 \ No newline at end of file diff --git a/examples/default.yaml b/examples/default.yaml new file mode 100644 index 00000000..28e87161 --- /dev/null +++ b/examples/default.yaml @@ -0,0 +1,6 @@ +--- +api_version: v1alpha1 +groups: + - name: PXE Boot to CoreOS + profile: pxe + metadata: