diff --git a/containers/portainer.inst b/containers/portainer.inst new file mode 100755 index 0000000..ebae2ac --- /dev/null +++ b/containers/portainer.inst @@ -0,0 +1,25 @@ + +portainer_install () { + + local target + local dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))" + target=${1:-/opt/portainer} + [[ -d $target ]] || mkdir -p $target + echo installing portainer to $target + if /bin/cp -f $dir/portainer/* $target; then + pushd $target || return + echo PORTAINER_DIR=$target >> .env + source .env + mkdir -p ${DATA:-$target/data} + ./config + ./start + sleep 5 + ./logs + else + echo unable to copy portainer files to $target, install aborted + fi + popd || return +} + +# if script was executed then call the function +(return 0 2>/dev/null) || portainer_install $@ diff --git a/containers/portainer/.env b/containers/portainer/.env new file mode 100644 index 0000000..40ddfeb --- /dev/null +++ b/containers/portainer/.env @@ -0,0 +1,9 @@ +#default 9000, uncomment and set +# PORT=9005 +# default 8000, uncomment and set +# EDGE_PORT=8005 +# default is /opt/portainer/data +# DATA=/mnt/extra/containers/EDGE_PORT=8005 +# DATA superceeds PORTAINER_DIR and this is set by install script + + diff --git a/containers/portainer/config b/containers/portainer/config new file mode 100755 index 0000000..4e03727 --- /dev/null +++ b/containers/portainer/config @@ -0,0 +1,2 @@ +#!/bin/bash +docker-compose config \ No newline at end of file diff --git a/containers/portainer/docker-compose.yaml b/containers/portainer/docker-compose.yaml new file mode 100644 index 0000000..e5fe50a --- /dev/null +++ b/containers/portainer/docker-compose.yaml @@ -0,0 +1,21 @@ +version: "2" + +services: + portainer: + container_name: portainer + image: portainer/portainer-ce:latest + restart: always + ports: + - "${PORT:-9000}:9000" + - "${EDGE_PORT:-8000}:8000" + command: -H unix:///var/run/docker.sock + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - portainer_data:/data + +volumes: + portainer_data: + driver_opts: + type: none + device: ${DATA:-${PORTAINER_DIR:-/opt/portainer}/data} + o: bind diff --git a/containers/portainer/logs b/containers/portainer/logs new file mode 100755 index 0000000..b977a21 --- /dev/null +++ b/containers/portainer/logs @@ -0,0 +1,2 @@ +#!/bin/bash +docker-compose logs \ No newline at end of file diff --git a/containers/portainer/make b/containers/portainer/make new file mode 100755 index 0000000..78e36b4 --- /dev/null +++ b/containers/portainer/make @@ -0,0 +1,2 @@ +#!/bin/bash +docker-compose up -d --force-recreate diff --git a/containers/portainer/start b/containers/portainer/start new file mode 100755 index 0000000..6c18257 --- /dev/null +++ b/containers/portainer/start @@ -0,0 +1,3 @@ +#!/bin/bash +docker-compose down +docker-compose up -d diff --git a/containers/portainer/stop b/containers/portainer/stop new file mode 100755 index 0000000..86699d3 --- /dev/null +++ b/containers/portainer/stop @@ -0,0 +1,2 @@ +#!/bin/bash +docker-compose down diff --git a/containers/portainer/term b/containers/portainer/term new file mode 100755 index 0000000..0b48fd2 --- /dev/null +++ b/containers/portainer/term @@ -0,0 +1,2 @@ +#!/bin/bash +docker exec -it portainer /bin/sh diff --git a/containers/portainer/upgrade b/containers/portainer/upgrade new file mode 100755 index 0000000..0045a98 --- /dev/null +++ b/containers/portainer/upgrade @@ -0,0 +1,4 @@ +#!/bin/bash +docker-compose down +docker-compose pull +docker-compose up -d