add systemd service leanup, fix config generation

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-11-15 10:35:26 +01:00 committed by Jakub
parent 9d7c570593
commit 92d6b1c439
5 changed files with 31 additions and 9 deletions

View File

@ -301,8 +301,14 @@ update-fleet-config: ##@other Update fleets configuration from fleets.status.im
run-bootnode-docker: ##@Easy way to run a bootnode locally with Docker Compose run-bootnode-docker: ##@Easy way to run a bootnode locally with Docker Compose
cd _assets/compose/bootnode/ && $(MAKE) cd _assets/compose/bootnode/ && $(MAKE)
run-mailserver-systemd: ##@Easy way to run a mailserver locally with systemd run-mailserver-systemd: ##@Easy Run a mailserver locally with systemd
@_assets/systemd/start.sh @_assets/systemd/start.sh
run-mailserver-docker: ##@Easy way to run a mailserver locally with Docker Compose run-mailserver-docker: ##@Easy Run a mailserver locally with Docker Compose
@cd _assets/compose/mailserver/ && $(MAKE) @cd _assets/compose/mailserver/ && $(MAKE)
clean-mailserver-systemd: ##@Easy Clean your systemd service for running a mailserver
@./_assets/systemd/clean.sh
clean-mailserver-docker: ##@Easy Clean your Docker container running a mailserver
@cd _assets/compose/mailserver/ && $(MAKE) clean

View File

@ -10,7 +10,7 @@ BOLD := $(shell tput bold)
export LOG_LEVEL ?= INFO export LOG_LEVEL ?= INFO
export LISTEN_PORT ?= 30303 export LISTEN_PORT ?= 30303
export RPC_PORT ?= 8545 export RPC_PORT ?= 8545
export API_MODULES ?= eth,net,web3,admin export API_MODULES ?= eth,net,web3,admin,mailserver
export CONTAINER_NAME ?= status-go-mailserver export CONTAINER_NAME ?= status-go-mailserver
export DATA_PATH ?= /var/tmp/status-go-mail export DATA_PATH ?= /var/tmp/status-go-mail
export FLEET_NAME ?= eth.beta export FLEET_NAME ?= eth.beta

View File

@ -4,7 +4,7 @@ GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
# Settings & defaults # Settings & defaults
RPC_PORT="${RPC_PORT:-8545}" RPC_PORT="${RPC_PORT:-8545}"
API_MODULES="${API_MODULES:-eth,net,web3,admin}" API_MODULES="${API_MODULES:-eth,net,web3,admin,mailserver}"
FLEET_NAME="${FLEET_NAME:-eth.beta}" FLEET_NAME="${FLEET_NAME:-eth.beta}"
REGISTER_TOPIC="${REGISTER_TOPIC:-whispermail}" REGISTER_TOPIC="${REGISTER_TOPIC:-whispermail}"
MAIL_PASSWORD="${MAIL_PASSWORD:-status-offline-inbox}" MAIL_PASSWORD="${MAIL_PASSWORD:-status-offline-inbox}"
@ -35,6 +35,9 @@ JQ_FILTER_ARRAY=(
JQ_FILTER=$(printf " | %s" "${JQ_FILTER_ARRAY[@]}") JQ_FILTER=$(printf " | %s" "${JQ_FILTER_ARRAY[@]}")
# make sure config destination exists
mkdir -p "${DATA_PATH}"
echo "Generating config at: ${CONFIG_PATH}" echo "Generating config at: ${CONFIG_PATH}"
cat "${GIT_ROOT}/config/cli/fleet-${FLEET_NAME}.json" \ cat "${GIT_ROOT}/config/cli/fleet-${FLEET_NAME}.json" \

View File

@ -22,11 +22,9 @@ In order to manage the new `statusd` service you use `systemctl` command:
* `systemctl --user disable statusd` - Disable the service * `systemctl --user disable statusd` - Disable the service
* `journalctl --user-unit statusd` - Read the service logs * `journalctl --user-unit statusd` - Read the service logs
If you want to remove the service you can just remove its definition: If you want to remove the service you can use the `clean.sh` script:
``` ```bash
systemctl --user stop statusd _assets/systemd/clean.sh
rm ~/.config/systemd/user/statusd.service
systemctl --user daemon-reload
``` ```
# Settings # Settings

15
_assets/systemd/clean.sh Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Settings & defaults
export SERVICE_NAME="${SERVICE_NAME:-statusd}"
# stop before removing
systemctl --user stop "${SERVICE_NAME}"
systemctl --user disable "${SERVICE_NAME}"
# remove the service definition file
rm -f "${HOME}/.config/systemd/user/${SERVICE_NAME}.service"
# make systemd forget about it
systemctl --user daemon-reload
systemctl --user reset-failed