diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..5af0798 --- /dev/null +++ b/.env.sample @@ -0,0 +1,5 @@ +PROJECT_URL=portainer.localhost + +PROJECT_NAME=sample + +TRAEFIK_NETWORK=traefik_net diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1ed8d4d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: '1' + +networks: + default: + name: "${TRAEFIK_NETWORK}" + external: true + +services: + portainer: + image: "portainer/portainer-ce:alpine" + container_name: "${PROJECT_NAME}_portainer" + hostname: "${PROJECT_URL}" + command: "-H unix:///var/run/docker.sock" + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + - "data:/data" + restart: always + labels: + # Watchtower add to auto update + - "com.centurylinklabs.watchtower.enable=true" + # traefik + - "traefik.enable=true" + - "traefik.docker.network=${TRAEFIK_NETWORK}" + - "traefik.http.routers.${PROJECT_NAME}_portainer.rule=Host(`${PROJECT_URL}`)" + - "traefik.http.routers.${PROJECT_NAME}_portainer.entrypoints=websecure" + - "traefik.http.routers.${PROJECT_NAME}_portainer.tls=true" + - "traefik.http.services.${PROJECT_NAME}_portainer.loadbalancer.server.port=9000" + +volumes: + data: + name: "${PROJECT_NAME}-portainer-data" \ No newline at end of file diff --git a/init b/init new file mode 100644 index 0000000..845142c --- /dev/null +++ b/init @@ -0,0 +1,9 @@ +#!/bin/bash + +source ./.env + +mkdir -p ${PROJECT_DATA}/${PROJECT_NAME}-portainer/data + +docker network create $TRAEFIK_NETWORK + +docker compose up -d \ No newline at end of file