Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/auri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres123
POSTGRES_PASSWORD: postgres
POSTGRES_DB: auri_test
ports:
- 5432:5432
Expand All @@ -72,6 +72,8 @@ jobs:
run: |
go install github.com/gobuffalo/cli/cmd/buffalo@v${{ matrix.gobuffalo }}
- name: run unit tests
env:
DB_HOST: 127.0.0.1
run: |
cp fixtures/testing-config.env .env
make test
Expand Down
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM alpine

ENV AURI_POSTGRES_PORT=5432
ENV AURI_BUFFALO_PORT=3000
ENV AURI_GO_VERSION=1.18.3
ENV AURI_BUFFALO_VERSION=0.18.4
ENV AURI_ARCH=arm64
#or amd64

ENV PGHOST=db
ENV PGUSER=postgres
ENV PGPASSWORD=postgres

COPY support/dev-env/ /

RUN apk add -U gcompat wget git postgresql12-client

# go setup
RUN <<NUR
wget --progress=dot:giga -O golang.tgz https://golang.org/dl/go${AURI_GO_VERSION}.linux-${AURI_ARCH}.tar.gz
tar -C /usr/local -xzf golang.tgz
NUR
ENV PATH=$PATH:/usr/local/go/bin

# buffalo setup
RUN <<NUR
apk add nodejs npm gcc musl-dev
git clone https://github.com/gobuffalo/cli.git
cd cli && git checkout v${AURI_BUFFALO_VERSION}
go mod tidy && cd cmd/buffalo/ && go build -tags sqlite && mv buffalo /usr/local/go/bin/

npm install -g yarn
yarn config set yarn-offline-mirror /npm-packages-offline-cache
yarn config set yarn-offline-mirror-pruning true

npm install webpack webpack-cli

git config --global --add safe.directory /data
NUR

# dependencies for node
RUN <<NUR
apk add make g++
NUR

# buffalo dev should listen on 0.0.0.0 to get port forwarding working
ENV ADDR=0.0.0.0

RUN mkdir /data
WORKDIR /data
VOLUME /data
CMD docker-entrypoint.sh
14 changes: 7 additions & 7 deletions database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ development:
dialect: postgres
database: {{envOr "DB_NAME" "auri_development"}}
user: {{envOr "DB_USER" "postgres"}}
password: {{envOr "DB_PASSWORD" "postgres123"}}
host: {{envOr "DB_HOST" "127.0.0.1"}}
password: {{envOr "DB_PASSWORD" "postgres"}}
host: {{envOr "DB_HOST" "db"}}
pool: 5

test:
dialect: postgres
database: {{envOr "DB_NAME" "auri_test"}}
user: {{envOr "DB_USER" "postgres"}}
password: {{envOr "DB_PASSWORD" "postgres123"}}
host: {{envOr "DB_HOST" "127.0.0.1"}}
password: {{envOr "DB_PASSWORD" "postgres"}}
host: {{envOr "DB_HOST" "db"}}
pool: 5

production:
dialect: postgres
database: {{envOr "DB_NAME" "auri_production"}}
user: {{envOr "DB_USER" "postgres"}}
password: {{envOr "DB_PASSWORD" "postgres123"}}
host: {{envOr "DB_HOST" "127.0.0.1"}}
pool: 5
password: {{envOr "DB_PASSWORD" "postgres"}}
host: {{envOr "DB_HOST" "db"}}
pool: 5
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
dev:
build: .
ports:
- "3000:3000"
- "35729:35729" # livereload
volumes:
- .:/data
links:
- db
db:
image: postgres:12-alpine
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
13 changes: 13 additions & 0 deletions support/dev-env/usr/local/bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

sleep 5s # wait for DB to get initialized

psql -c "CREATE DATABASE auri_development;"
psql -c "CREATE DATABASE auri_test;"
psql -c "CREATE DATABASE auri_production;"

psql -c "GRANT ALL PRIVILEGES ON DATABASE auri_development to postgres;"
psql -c "GRANT ALL PRIVILEGES ON DATABASE auri_test to postgres;"
psql -c "GRANT ALL PRIVILEGES ON DATABASE auri_production to postgres;"

sleep 10d