-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from dyrector-io/fix/repair-macos-dagent--script
fix: repair the dagent install script in MacOS
- Loading branch information
Showing
3 changed files
with
57 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,67 @@ | ||
#!/bin/sh set -e if [ `id -u` -ne 0 ] ; then echo "Installation process needs root privileges" 1>&2 sudo -s fi if [ -z | ||
"$(which docker)" ]; then \ echo "Docker is required, make sure it is installed and available in PATH!"\ exit 1 fi echo | ||
"Installing dyrector.io agent (dagent)..." if [ $(docker ps --no-trunc --filter name=^/dagent$ | tail -n +2 | wc -l) -eq | ||
1 ]; then echo "DAgent is is running already, terminating" docker stop dagent fi if [ $(docker ps -a --no-trunc --filter | ||
name=^/dagent$ | tail -n +2 | wc -l) -eq 1 ]; then docker rm dagent else echo "DAgent not running, installing..." fi | ||
mkdir -p /srv/dagent docker pull | ||
{{image}} | ||
|
||
docker run \ --restart unless-stopped \ -e GRPC_TOKEN='{{token}}' \ -e HOSTNAME="$HOSTNAME || $HOST || '{{name}}'" \ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Setup the default root folder for volumes | ||
if [ $(uname -s) == 'Darwin' ]; then | ||
echo "Detected: Mac OS X" | ||
ROOT_FOLDER='/Volumes/dyrectorio/srv/dagent' | ||
elif [ $(uname -s) == 'Linux' ]; then | ||
echo "Detected: Linux" | ||
ROOT_FOLDER='/srv/dagent' | ||
else | ||
echo "Not supported OS!" | ||
fi | ||
|
||
|
||
if [ $(id -u) -ne 0 ]; then | ||
echo "Installation process needs root privileges" sudo -s 1>&2 | ||
fi | ||
|
||
if [ -z "$(which docker)" ]; then | ||
echo "Docker is required, make sure it is installed and available in PATH!" | ||
exit 1 | ||
fi | ||
|
||
echo "Installing dyrector.io agent (dagent)..." | ||
|
||
if [ $(docker ps --no-trunc --filter name=^/dagent$ | tail -n +2 | wc -l) -eq 1 ]; then | ||
echo "DAgent is is running already, terminating" | ||
docker stop dagent | ||
fi | ||
|
||
if [ $(docker ps -a --no-trunc --filter name=^/dagent$ | tail -n +2 | wc -l) -eq 1 ]; then | ||
docker rm dagent | ||
else | ||
echo "DAgent not running, installing..." | ||
fi | ||
|
||
mkdir -p $ROOT_FOLDER | ||
docker pull {{image}} | ||
|
||
docker run \ | ||
--restart unless-stopped \ | ||
-e GRPC_TOKEN='{{token}}' \ | ||
-e HOSTNAME="$HOSTNAME || $HOST || '{{name}}'" \ | ||
{{#if traefik}} | ||
-e TRAEFIK= '' \ | ||
{{/if}} | ||
-e DATA_MOUNT_PATH='/srv/dagent' \ -e UPDATE_METHOD='off' \ -e UPDATE_POLL_INTERVAL='600s' \ | ||
-e DATA_MOUNT_PATH=$ROOT_FOLDER \ | ||
-e UPDATE_METHOD='off' \ | ||
-e UPDATE_POLL_INTERVAL='600s' \ | ||
{{#if insecure}} | ||
-e GRPC_INSECURE='true' \ | ||
{{/if}} | ||
-e DAGENT_IMAGE='ghcr.io/dyrector-io/dyrectorio/dagent' \ -e DAGENT_TAG='stable' \ -e DAGENT_NAME='{{name}}' \ -v | ||
/var/run/docker.sock:/var/run/docker.sock \ --name 'dagent' \ | ||
-e DAGENT_IMAGE='ghcr.io/dyrector-io/dyrectorio/agent/dagent' \ | ||
-e DAGENT_TAG='stable' \ | ||
-e DAGENT_NAME='{{name}}' \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
--name 'dagent' \ | ||
{{! -e UPDATE_REGISTRY_USER='' \ }} | ||
{{! -e UPDATE_REGISTRY_PASSWORD='' \ }} | ||
{{! -e UPDATER_CONTAINER_NAME ='' \ }} | ||
{{! -e UPDATE_HOST_TIMEZONE='' \ }} | ||
{{! -e HOST_DOCKER_SOCK='' \ }} | ||
{{! -e WEBHOOK_TOKEN='' \ }} | ||
{{! -e DISCORD_WEBHOOK_URL='' \ }} | ||
-v /srv/dagent/:/srv/dagent \ -d \ | ||
{{image}} | ||
-v $ROOT_FOLDER/:$ROOT_FOLDER -d {{image}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters