From a3d317f522cfb8feca3804ad513f5b3c70685da6 Mon Sep 17 00:00:00 2001 From: digikin Date: Wed, 26 Jun 2019 06:23:07 -0400 Subject: [PATCH 1/5] fixing some of the labels --- README.md | 10 +++++++++- docker-compose.yml | 31 +++++++++++++++++++++++++------ traefik.toml | 18 ++++-------------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 29d0da2..25f451e 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,15 @@ entryPoint = "traefik" debug = true ``` This configuration is a basic setup to expose the dashboard. -Check it out. +Check it out. http://localhost:8080 +Now we are going to configure basic authorization to the backend and change the entry point through the toml file. +In the termial we need to create a htpasswd. +```sudo apt-get install apache2-utils +htpasswd -nb admin super_secret_password``` +Save the output and we will add to out traefik.toml. +``` + +You should get somthing back like. ## Compose up Run the command: diff --git a/docker-compose.yml b/docker-compose.yml index eb5b5c9..f353afe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,17 +5,36 @@ services: image: traefik:v1.7 command: --api --docker ports: - - 8080:8080 + - 80:80 + networks: + - proxy + labels: + - "traefik.frontend.rule=Host:web.localhost" + - "traefik.port=8080" volumes: + - ./traefik.toml:/traefik.toml - /var/run/docker.sock:/var/run/docker.sock nginx: image: nginx:latest - ports: - - 80:80 + networks: + - proxy + labels: + - "traefik.enable=true" + - "traefik.frontend.rule=PathPrefix:/static/" + - "traefik.docker.network=proxy" influxdb: image: quay.io/influxdb/influxdb:2.0.0-alpha - ports: - - 9999:9999 + networks: + - proxy labels: - "traefik.enable=true" - - "traefik.frontend.rule=Host:influx.localhost" \ No newline at end of file + - "traefik.backend=influx" + - "traefik.frontend.rule=Host:influx.localhost" + - "traefik.docker.network=proxy" + - "traefik.port=9999" +networks: + proxy: + external: + name: proxy + internal: + external: false diff --git a/traefik.toml b/traefik.toml index bd13970..c6dfbbd 100644 --- a/traefik.toml +++ b/traefik.toml @@ -3,18 +3,8 @@ endpoint = "unix:///var/run/docker.sock" domain = "localhost" watch = true exposedByDefault = true -usebindportip = true -swarmMode = false -network = "web" -entryPoints.dash] -address=":8080" -[entryPoints.dash.auth] -[entryPoints.dash.auth.basic] - users = [ - "hakase:$apr1$hEgpZUN2$OYG3KwpzI3T1FqIg9LIbi.", - ] -[api] -dashboard = true -entryPoint = "traefik" -debug = true \ No newline at end of file +[web] +address=":8080" + [web.auth.basic] + users = ["admin:$apr1$A3524hz3$4k45BqlgN1aiwOs1pjMD9."] From 00c0e0e435e47fc3e05fbac56b6ccfd6f39f56d1 Mon Sep 17 00:00:00 2001 From: Eric S Date: Wed, 26 Jun 2019 06:26:00 -0400 Subject: [PATCH 2/5] Delete README.md --- README.md | 65 ------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 25f451e..0000000 --- a/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# traefik-template -Traefik template for developing locally - -## Setup -Clone the repo locally and change into /traefik-template -Here is what the docker-compose file looks like. -``` -version: '3' - -services: - traefik: - image: traefik:v1.7 - command: --api --docker - ports: - - 8080:8080 - volumes: - - /var/run/docker.sock:/var/run/docker.sock - nginx: - image: nginx:latest - ports: - - 80:80 - influxdb: - image: quay.io/influxdb/influxdb:2.0.0-alpha - ports: - - 9999:9999 -``` -## Traefik.toml -``` -[docker] -endpoint = "unix:///var/run/docker.sock" -domain = "localhost" -watch = true -exposedByDefault = true -usebindportip = true -swarmMode = false -network = "web" -[api] -dashboard = true -entryPoint = "traefik" -debug = true -``` -This configuration is a basic setup to expose the dashboard. -Check it out. http://localhost:8080 -Now we are going to configure basic authorization to the backend and change the entry point through the toml file. -In the termial we need to create a htpasswd. -```sudo apt-get install apache2-utils -htpasswd -nb admin super_secret_password``` -Save the output and we will add to out traefik.toml. -``` - -You should get somthing back like. - -## Compose up -Run the command: -`docker-compose up` to watch the logs -or -`docker-compose up -d` for it to run in the background. - -## Services -1. The dashboard is running at http://localhost:8080 -2. Nginx is running on the main domain http://localhost -3. InfluxDB 2.0 is running on http://influx.localhost:9999 which it should automatically pull up port 9999 - -## Template -This is a template where anyone can build upon this. The next step is to configure ssl. (More to come) From d57f628fa2a24f236945d1283e2f6e39ad884713 Mon Sep 17 00:00:00 2001 From: Eric S Date: Wed, 26 Jun 2019 06:27:01 -0400 Subject: [PATCH 3/5] Create Readme.md --- template2/Readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 template2/Readme.md diff --git a/template2/Readme.md b/template2/Readme.md new file mode 100644 index 0000000..18fb245 --- /dev/null +++ b/template2/Readme.md @@ -0,0 +1 @@ +fd From 4f90ec58ff2533ac0d2fbf8a8abc0b4ef2165f26 Mon Sep 17 00:00:00 2001 From: Eric S Date: Wed, 26 Jun 2019 06:28:23 -0400 Subject: [PATCH 4/5] Rename docker-compose.yml to template2/docker-compose.yml --- docker-compose.yml => template2/docker-compose.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker-compose.yml => template2/docker-compose.yml (100%) diff --git a/docker-compose.yml b/template2/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to template2/docker-compose.yml From 8fddda34f78bb78c650294068e7384c0d4b17821 Mon Sep 17 00:00:00 2001 From: Eric S Date: Wed, 26 Jun 2019 06:28:46 -0400 Subject: [PATCH 5/5] Rename traefik.toml to template2/traefik.toml --- traefik.toml => template2/traefik.toml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename traefik.toml => template2/traefik.toml (100%) diff --git a/traefik.toml b/template2/traefik.toml similarity index 100% rename from traefik.toml rename to template2/traefik.toml