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

Merge pull request #2 from offen/postgres

Add initial postgres database connector
This commit is contained in:
Frederik Ring 2019-04-19 17:45:46 -06:00 committed by GitHub
commit 509f2999e8
3 changed files with 50 additions and 2 deletions

View File

@ -4,6 +4,12 @@ jobs:
server:
docker:
- image: circleci/golang:1.12
environment:
- POSTGRES_CONNECTION_STRING=postgres://circle:test@localhost:5432/circle_test?sslmode=disable
- image: circleci/postgres:11.2-alpine
environment:
- POSTGRES_USER=circle
- POSTGRES_PASSWORD=test
working_directory: ~/offen/server
steps:
- checkout:
@ -17,9 +23,19 @@ jobs:
paths:
- /go/pkg/mod
key: offen-server-{{ checksum "go.mod" }}
- run:
name: Waiting for Postgres to be ready
command: |
for i in `seq 1 10`;
do
nc -z localhost 5432 && echo Success && exit 0
echo -n .
sleep 1
done
echo Failed waiting for Postgres && exit 1
- run:
name: Run tests
command: make test
command: make test-ci
workflows:
version: 2

View File

@ -9,6 +9,30 @@ Development of __offen__ has just started, so instructions are rare and things w
Guidelines for running and developing the Software will be added when it makes sense to do so. Feel free to open an issue if you have a question.
### Developing the application
#### `server`
To work on the `server` you will need to install `docker-compose` and Go 1.12+.
First, bootstrap the dockerized Postgres database used for development:
```
docker-compose run server make bootstrap
```
Run the server:
```
docker-compose up
```
Run the tests:
```
docker-compose run server make
```
### License
MIT © [Frederik Ring](https://www.frederikring.com), [Hendrik Niefeld](http://niefeld.com/)

View File

@ -6,6 +6,14 @@ server:
- $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
command: go run cmd/server/main.go -conn postgres://postgres:develop@database:5432/postgres?sslmode=disable
links:
- database
database:
image: postgres:11.2
environment:
- POSTGRES_PASSWORD=develop