From 2706711592fe43deb4e1856e8ca539759b6beae2 Mon Sep 17 00:00:00 2001 From: Oriol Tauleria Date: Sat, 14 Nov 2020 18:40:53 +0100 Subject: [PATCH 1/5] Update Docker info in Readme - Extract Config elements to env. vars - Update mandatory vars in docker --- README.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 51eadc6c..48a0d41d 100644 --- a/README.md +++ b/README.md @@ -132,23 +132,32 @@ the app itself and a PostgreSQL database for it to store information in. # Set AWS credentials as environment variables: export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= + +# Set AWS configuration as environment variables: +export AWS_DEFAULT_REGION= +export AWS_BUCKET= +export AWS_DYNAMODB_TABLE= + # Spin up the two containers and a network for them to communciate on: -docker network create terranet +docker network create terraboard docker run --name db \ -e POSTGRES_USER=gorm \ -e POSTGRES_DB=gorm \ -e POSTGRES_PASSWORD="" \ - --net terranet \ - --restart=always postgres -d + --net terraboard \ + --detach \ + --restart=always \ + postgres:9.5 + docker run -p 8080:8080 \ - -e AWS_REGION="" \ -e AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \ -e AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \ - -e AWS_BUCKET="" \ - -e AWS_DYNAMODB_TABLE="" \ + -e AWS_REGION="${AWS_DEFAULT_REGION}" \ + -e AWS_BUCKET="${AWS_BUCKET}" \ + -e WS_DYNAMODB_TABLE="${AWS_DYNAMODB_TABLE}" \ -e DB_PASSWORD="" \ - -e APP_ROLE_ARN="" \ - --net terranet \ + -e DB_SSLMODE="disable" \ + --net terraboard \ camptocamp/terraboard:latest ``` From 92d6132f6a3dc423e2ea5eff89929786869430e8 Mon Sep 17 00:00:00 2001 From: Oriol Tauleria Date: Sat, 14 Nov 2020 19:04:28 +0100 Subject: [PATCH 2/5] Update reference to ouath2_proxy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 48a0d41d..827eb10e 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ contains a Terraboard template to automate its installation in Cattle. ## Authentication and base URL Terraboard does not implement authentication. Instead, it is recommended to use -an authentication proxy such as [oauth2_proxy](https://github.com/bitly/oauth2_proxy). +an authentication proxy such as [oauth2_proxy](https://github.com/camptocamp/oauth2_proxy). If you need to set a route path for Terraboard, you can set a base URL by passing it as the `BASE_URL` environment variable. From 622a40bea0ab0e906cc4e9b7c2001fcc04a4679d Mon Sep 17 00:00:00 2001 From: Oriol Tauleria Date: Sat, 14 Nov 2020 19:04:42 +0100 Subject: [PATCH 3/5] Split docker and docker-compose instructions. --- README.md | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 827eb10e..092de2c9 100644 --- a/README.md +++ b/README.md @@ -125,8 +125,37 @@ The precedence of configurations is as described below. ## Use with Docker -Either use the included docker-compose file, or run two containers from the commandline: -the app itself and a PostgreSQL database for it to store information in. +### Docker-compose + +To use the included compose file, you will need to configure an OAuth application from Github, more information in next section [Authentication and base URL](#Authentication-and-base-URL) + +Configuration file can be provided to the container using a [volume](https://docs.docker.com/compose/compose-file/#volumes) or a [configuration](https://docs.docker.com/compose/compose-file/#configs). + +```shell +# Set oauth information: +export OAUTH_CLIENT_ID=<> +export OAUTH_CLIENT_SECRET=<> +export OAUTH_COOKIE_SECRET=<> + +# Set AWS credentials as environment variables: +export AWS_ACCESS_KEY_ID= +export AWS_SECRET_ACCESS_KEY= + +# Set AWS configuration as environment variables: +export AWS_DEFAULT_REGION= +export AWS_BUCKET= +export AWS_DYNAMODB_TABLE= +export AWS_KEY_PREFIX= + +# Set basic Terraboard configuration +export TERRABOARD_LOG_LEVEL= + +docker-compose up +``` + +Then point your browser to http://localhost. + +### Docker command line ```shell # Set AWS credentials as environment variables: @@ -163,10 +192,6 @@ docker run -p 8080:8080 \ Then point your browser to http://localhost:8080. -To use the included compose file, you will need to configure an [OAuth application](https://developer.github.com/apps/building-oauth-apps/). - -Configuration file can be provided to the container using a [volume](https://docs.docker.com/compose/compose-file/#volumes) or a [configuration](https://docs.docker.com/compose/compose-file/#configs). - ## Use with Rancher [Camptocamp's Rancher Catalog](https://github.com/camptocamp/camptocamp-rancher-catalog) From a14446f5b24b22caf21726a68df2bc6273b09779 Mon Sep 17 00:00:00 2001 From: Oriol Tauleria Date: Sat, 14 Nov 2020 19:08:38 +0100 Subject: [PATCH 4/5] Unify postgress db_ssl mode in docker-compose --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index a794d0a6..dd04df5e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: AWS_FILE_EXTENSION: ${AWS_FILE_EXTENSION} BASE_URL: /terraboard/ DB_PASSWORD: mypassword + DB_SSLMODE: disable AWS_DYNAMODB_TABLE: ${AWS_DYNAMODB_TABLE} AWS_KEY_PREFIX: ${AWS_KEY_PREFIX} TERRABOARD_LOG_LEVEL: ${TERRABOARD_LOG_LEVEL} From c1df224f130a2a78ef8298ef0bb31db8b25ca91d Mon Sep 17 00:00:00 2001 From: Oriol Tauleria Date: Tue, 17 Nov 2020 16:24:28 +0100 Subject: [PATCH 5/5] Clean proxy references. --- README.md | 15 ++------------- docker-compose.yml | 23 ++--------------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 092de2c9..496abe27 100644 --- a/README.md +++ b/README.md @@ -127,16 +127,9 @@ The precedence of configurations is as described below. ### Docker-compose -To use the included compose file, you will need to configure an OAuth application from Github, more information in next section [Authentication and base URL](#Authentication-and-base-URL) - Configuration file can be provided to the container using a [volume](https://docs.docker.com/compose/compose-file/#volumes) or a [configuration](https://docs.docker.com/compose/compose-file/#configs). ```shell -# Set oauth information: -export OAUTH_CLIENT_ID=<> -export OAUTH_CLIENT_SECRET=<> -export OAUTH_COOKIE_SECRET=<> - # Set AWS credentials as environment variables: export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= @@ -145,15 +138,11 @@ export AWS_SECRET_ACCESS_KEY= export AWS_DEFAULT_REGION= export AWS_BUCKET= export AWS_DYNAMODB_TABLE= -export AWS_KEY_PREFIX= - -# Set basic Terraboard configuration -export TERRABOARD_LOG_LEVEL= docker-compose up ``` -Then point your browser to http://localhost. +Then point your browser to http://localhost:8080. ### Docker command line @@ -201,7 +190,7 @@ contains a Terraboard template to automate its installation in Cattle. ## Authentication and base URL Terraboard does not implement authentication. Instead, it is recommended to use -an authentication proxy such as [oauth2_proxy](https://github.com/camptocamp/oauth2_proxy). +an authentication proxy such as [oauth2_proxy](https://github.com/bitly/oauth2_proxy). If you need to set a route path for Terraboard, you can set a base URL by passing it as the `BASE_URL` environment variable. diff --git a/docker-compose.yml b/docker-compose.yml index dd04df5e..27574291 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,34 +11,15 @@ services: AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} AWS_REGION: ${AWS_DEFAULT_REGION} AWS_BUCKET: ${AWS_BUCKET} - AWS_FILE_EXTENSION: ${AWS_FILE_EXTENSION} - BASE_URL: /terraboard/ + AWS_DYNAMODB_TABLE: ${AWS_DYNAMODB_TABLE} DB_PASSWORD: mypassword DB_SSLMODE: disable - AWS_DYNAMODB_TABLE: ${AWS_DYNAMODB_TABLE} - AWS_KEY_PREFIX: ${AWS_KEY_PREFIX} - TERRABOARD_LOG_LEVEL: ${TERRABOARD_LOG_LEVEL} - TERRABOARD_LOGOUT_URL: /oauth2/sign_in depends_on: - "db" volumes: - ./static:/static:ro - - proxy: - image: camptocamp/oauth2_proxy - command: - - -http-address=0.0.0.0:80 - - -upstream=http://terraboard:8080/terraboard/ - - -provider=github - - -email-domain=* - - -cookie-secure=false - - -redirect-url=http://localhost/oauth2/callback - environment: - OAUTH2_PROXY_CLIENT_ID: ${OAUTH_CLIENT_ID} - OAUTH2_PROXY_CLIENT_SECRET: ${OAUTH_CLIENT_SECRET} - OAUTH2_PROXY_COOKIE_SECRET: ${OAUTH_COOKIE_SECRET} ports: - - 80:80 + - "8080:8080" db: image: postgres:9.5