2
0
mirror of https://github.com/offen/website.git synced 2024-12-23 13:30:20 +01:00

Merge pull request #7 from offen/local-ssl

Enable using ssl in local development
This commit is contained in:
Frederik Ring 2019-04-25 20:10:06 -06:00 committed by GitHub
commit af42f29587
4 changed files with 37 additions and 2 deletions

View File

@ -10,6 +10,6 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
[{*.js,*.yml,Gopkg.toml}]
[{*.js,*.yml,*.md,Gopkg.toml}]
indent_style = space
indent_size = 2

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.vscode
# mkcert certificates
*.pem

View File

@ -12,6 +12,34 @@ Guidelines for running and developing the Software will be added when it makes s
### Developing the application
#### Local cookies and SSL
In local development __offen__ requires to be served both via SSL (in order to use window.crypto) as well as a `local.offen.org` host.
This requires the following steps to be taken:
1. Edit your `/etc/hosts` to include the following line:
```
127.0.0.1 local.offen.org
```
2. Install and setup [mkcert](https://github.com/FiloSottile/mkcert). Assuming you have Go installed, this looks like:
```
$ go get -u github.com/FiloSottile/mkcert
$ mkcert -install
```
3. Navigate into the repository root and create a local certificate and key for the `local.offen.org` host:
```
$ mkcert local.offen.org
```
You can test setup by starting the application:
```
$ docker-compose up
```
Now you should be able to access <https://local.offen.org:8080/status> in your browser without any security warnings.
#### `server`
To work on the `server` you will need to install `docker-compose` and Go 1.12+.

View File

@ -3,13 +3,15 @@ server:
working_dir: /server
volumes:
- ./server:/server
- ./local.offen.org.pem:/server/local.offen.org.pem
- ./local.offen.org-key.pem:/server/local.offen.org-key.pem
- $GOPATH/pkg/mod:/go/pkg/mod
environment:
- GOPATH=/go
- POSTGRES_CONNECTION_STRING=postgres://postgres:develop@database:5432/postgres?sslmode=disable
ports:
- 8080:8080
command: go run cmd/server/main.go -conn postgres://postgres:develop@database:5432/postgres?sslmode=disable
command: go run cmd/server/main.go -conn postgres://postgres:develop@database:5432/postgres?sslmode=disable -key local.offen.org-key.pem -cert local.offen.org.pem
links:
- database
@ -23,6 +25,8 @@ vault:
working_dir: /vault
volumes:
- ./vault:/vault
- ./local.offen.org.pem:/vault/local.offen.org.pem
- ./local.offen.org-key.pem:/vault/local.offen.org-key.pem
command: npm start -- --port 9977
ports:
- 9977:9977