From d48e20678627ca685a40935db2b2554b37a9a897 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Thu, 28 Dec 2023 13:33:50 -0600 Subject: [PATCH] organizational cleanup - add my docker-compose example, remove others - ditch nginx image - move tailscale image from images/tailscale to image/ --- docker-compose-example/docker-compose.yml | 15 ++++++++++++++ .../complex-example/docker-compose.yml | 20 ------------------- .../simple-example/docker-compose.yml | 14 ------------- .../stateful-example/docker-compose.yml | 15 -------------- {images/tailscale => image}/Dockerfile | 0 {images/tailscale => image}/start.sh | 0 images/nginx/Dockerfile | 3 --- images/nginx/conf.d/default.conf | 18 ----------------- 8 files changed, 15 insertions(+), 70 deletions(-) create mode 100644 docker-compose-example/docker-compose.yml delete mode 100644 docker-compose/complex-example/docker-compose.yml delete mode 100644 docker-compose/simple-example/docker-compose.yml delete mode 100644 docker-compose/stateful-example/docker-compose.yml rename {images/tailscale => image}/Dockerfile (100%) rename {images/tailscale => image}/start.sh (100%) delete mode 100644 images/nginx/Dockerfile delete mode 100644 images/nginx/conf.d/default.conf diff --git a/docker-compose-example/docker-compose.yml b/docker-compose-example/docker-compose.yml new file mode 100644 index 0000000..a3d9747 --- /dev/null +++ b/docker-compose-example/docker-compose.yml @@ -0,0 +1,15 @@ +services: + tailscale: + build: + context: ./image/ + container_name: tailscale + environment: + TS_AUTH_KEY: ${TS_AUTH_KEY:?err} # from https://login.tailscale.com/admin/settings/authkeys + TS_HOSTNAME: ${TS_HOSTNAME:-ts-docker} + TS_STATE_ARG: "/var/lib/tailscale/tailscale.state" # store ts state in a local volume + TS_SERVE_PORT: ${TS_SERVE_PORT:-} + volumes: + - ./ts_data:/var/lib/tailscale/ + myservice: + image: nginxdemos/hello + network_mode: "service:tailscale" diff --git a/docker-compose/complex-example/docker-compose.yml b/docker-compose/complex-example/docker-compose.yml deleted file mode 100644 index ffb6a91..0000000 --- a/docker-compose/complex-example/docker-compose.yml +++ /dev/null @@ -1,20 +0,0 @@ -version: "3.9" -services: - tailscale: - build: - context: images/tailscale - environment: - TAILSCALE_AUTH_KEY: ${TAILSCALE_AUTH_KEY:?err} - TAILSCALE_HOSTNAME: ${TAILSCALE_HOSTNAME:-tailscale-docker-complex-example} - TAILSCALE_STATE_ARG: "mem:" - nginx: - build: - context: images/nginx - depends_on: - - service-one - - service-two - network_mode: "service:tailscale" - service-one: - image: nginxdemos/hello - service-two: - image: nginxdemos/hello diff --git a/docker-compose/simple-example/docker-compose.yml b/docker-compose/simple-example/docker-compose.yml deleted file mode 100644 index 333299c..0000000 --- a/docker-compose/simple-example/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: "3.9" -services: - tailscale: - build: - context: ../../images/tailscale - environment: - TAILSCALE_AUTH_KEY: ${TAILSCALE_AUTH_KEY:?err} - TAILSCALE_HOSTNAME: ${TAILSCALE_HOSTNAME:-tailscale-docker-simple-example} - TAILSCALE_STATE_ARG: "mem:" - # (optional) set additional flags on tailscaled - # TAILSCALE_OPT: --outbound-http-proxy-listen=localhost:1055 - some-service-1: - image: nginxdemos/hello - network_mode: "service:tailscale" diff --git a/docker-compose/stateful-example/docker-compose.yml b/docker-compose/stateful-example/docker-compose.yml deleted file mode 100644 index 039bade..0000000 --- a/docker-compose/stateful-example/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: "3.9" -services: - tailscale: - build: - context: ../../images/tailscale - environment: - TAILSCALE_AUTH_KEY: ${TAILSCALE_AUTH_KEY:?err} - TAILSCALE_HOSTNAME: ${TAILSCALE_HOSTNAME:-tailscale-docker-stateful-example} - TAILSCALE_STATE_ARG: "/var/lib/tailscale_state/tailscale.state" # a file - volumes: - # a volume is used but it could be a local directory. - - /var/lib/tailscale_state/ - some-service-1: - image: nginxdemos/hello - network_mode: "service:tailscale" diff --git a/images/tailscale/Dockerfile b/image/Dockerfile similarity index 100% rename from images/tailscale/Dockerfile rename to image/Dockerfile diff --git a/images/tailscale/start.sh b/image/start.sh similarity index 100% rename from images/tailscale/start.sh rename to image/start.sh diff --git a/images/nginx/Dockerfile b/images/nginx/Dockerfile deleted file mode 100644 index 25fb557..0000000 --- a/images/nginx/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM nginx:1.23 -# based on debian:bullseye-slim -COPY conf.d /etc/nginx/conf.d diff --git a/images/nginx/conf.d/default.conf b/images/nginx/conf.d/default.conf deleted file mode 100644 index e952418..0000000 --- a/images/nginx/conf.d/default.conf +++ /dev/null @@ -1,18 +0,0 @@ -server { - listen 80 default_server; - server_name _; - - location /service-one { - proxy_pass http://service-one/; - proxy_set_header Host $http_host; - access_log /dev/stdout; - error_log /dev/stdout; - } - - location /service-two { - proxy_pass http://service-two/; - proxy_set_header Host $http_host; - access_log /dev/stdout; - error_log /dev/stdout; - } -} \ No newline at end of file