Skip to content

Commit

Permalink
Merge pull request #223 from gabriel-samfira/use-user-service
Browse files Browse the repository at this point in the history
Use user service
  • Loading branch information
gabriel-samfira authored Feb 26, 2024
2 parents 72c5364 + 43b3db5 commit c233559
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/integration/config/garm.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target
WantedBy=default.target
7 changes: 4 additions & 3 deletions test/integration/scripts/setup-garm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ sudo cp $CONFIG_DIR_PROV/* ${GARM_CONFIG_DIR}/test-provider

sudo mv $BINARIES_DIR/* /usr/local/bin/
mkdir -p $HOME/.local/share/systemd/user/
cat $CONFIG_DIR/garm.service| envsubst | tee $HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service > /dev/null
cat $CONFIG_DIR/garm.service| envsubst | sudo tee /lib/systemd/system/${GARM_SERVICE_NAME}@.service > /dev/null
sudo chown -R $RUN_USER:$RUN_USER ${GARM_CONFIG_DIR}

systemctl --user daemon-reload
systemctl --user restart ${GARM_SERVICE_NAME}
sudo systemctl daemon-reload
sudo systemctl enable ${GARM_SERVICE_NAME}@${RUN_USER}
sudo systemctl restart ${GARM_SERVICE_NAME}@${RUN_USER}
wait_open_port 127.0.0.1 ${GARM_PORT}

echo "GARM is up and running"
Expand Down
6 changes: 4 additions & 2 deletions test/integration/scripts/taredown_garm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ if [ -z $GARM_SERVICE_NAME ]; then
fi

if [ -f "$HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service" ];then
systemctl --user stop $GARM_SERVICE_NAME.service
rm $HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service
sudo systemctl stop $GARM_SERVICE_NAME@${RUN_USER}
sudo systemctl disable $GARM_SERVICE_NAME@${RUN_USER}
sudo rm /lib/systemd/system/${GARM_SERVICE_NAME}@.service
sudo systemctl daemon-reload
fi

if [ -d "$GARM_CONFIG_DIR" ] && [ -f "$GARM_CONFIG_DIR/config.toml" ] && [ -f "$GARM_CONFIG_DIR/garm-provider-lxd.toml" ];then
Expand Down

0 comments on commit c233559

Please sign in to comment.