added systemd unit file and target for make

This commit is contained in:
anastasia prasolova 2019-11-06 16:09:07 +03:00
parent 79d0c7446a
commit 95345b673a
2 changed files with 33 additions and 0 deletions

View file

@ -19,6 +19,21 @@ build: deps
&& export CGO_ENABLED=0 \
&& go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go
install: build
@echo "=> Preparing directories and configs"
@id neo-go || useradd -s /usr/sbin/nologin -d /var/lib/neo-go neo-go \
&& mkdir -p /var/lib/neo-go \
&& chown -R neo-go:neo-go /var/lib/neo-go
@echo "=> Installing systemd service"
@mkdir -p /etc/neo-go \
&& mkdir -p /etc/systemd/system/ \
&& cp ./neo-go.service /etc/systemd/system/ \
&& cp ./config/protocol.mainnet.yml /etc/neo-go \
&& systemctl enable neo-go.service \
&& mv ./bin/neo-go /usr/local/bin/neo-go \
&& chown neo-go:neo-go /usr/local/bin/neo-go
@echo "Done. Start Neo Go with 'systemctl start neo-go.service'"
image:
@echo "=> Building image"
@docker build -t cityofzion/neo-go:latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .

18
neo-go.service Normal file
View file

@ -0,0 +1,18 @@
[Unit]
Description=Neo Go node
Requires=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/neo-go node --mainnet --config-path=/etc/neo-go
User=neo-go
Group=neo-go
Restart=always
RestartSec=5
StandardError=syslog
SyslogIdentifier=neo-go
PrivateTmp=true
WorkingDirectory=/var/lib/neo-go
[Install]
WantedBy=multi-user.target