Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/docker instructions #124

Merged
merged 5 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 37 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,39 +125,62 @@ 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

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 AWS credentials as environment variables:
export AWS_ACCESS_KEY_ID=<access_key>
export AWS_SECRET_ACCESS_KEY=<access_secret>

# Set AWS configuration as environment variables:
export AWS_DEFAULT_REGION=<AWS default region>
export AWS_BUCKET=<S3 Bucket name>
export AWS_DYNAMODB_TABLE=<Aws DynamoDB Table>

docker-compose up
```

Then point your browser to http://localhost:8080.

### Docker command line

```shell
# Set AWS credentials as environment variables:
export AWS_ACCESS_KEY_ID=<access_key>
export AWS_SECRET_ACCESS_KEY=<access_secret>

# Set AWS configuration as environment variables:
export AWS_DEFAULT_REGION=<AWS default region>
export AWS_BUCKET=<S3 Bucket name>
export AWS_DYNAMODB_TABLE=<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="<mypassword>" \
--net terranet \
--restart=always postgres -d
--net terraboard \
--detach \
--restart=always \
postgres:9.5

docker run -p 8080:8080 \
-e AWS_REGION="<region>" \
-e AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
-e AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
-e AWS_BUCKET="<bucket>" \
-e AWS_DYNAMODB_TABLE="<table>" \
-e AWS_REGION="${AWS_DEFAULT_REGION}" \
-e AWS_BUCKET="${AWS_BUCKET}" \
-e WS_DYNAMODB_TABLE="${AWS_DYNAMODB_TABLE}" \
-e DB_PASSWORD="<mypassword>" \
-e APP_ROLE_ARN="<myrolearn>" \
--net terranet \
-e DB_SSLMODE="disable" \
--net terraboard \
camptocamp/terraboard:latest
```

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)
Expand Down
24 changes: 3 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +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/
DB_PASSWORD: mypassword
AWS_DYNAMODB_TABLE: ${AWS_DYNAMODB_TABLE}
AWS_KEY_PREFIX: ${AWS_KEY_PREFIX}
TERRABOARD_LOG_LEVEL: ${TERRABOARD_LOG_LEVEL}
TERRABOARD_LOGOUT_URL: /oauth2/sign_in
DB_PASSWORD: mypassword
DB_SSLMODE: disable
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
Expand Down