Compare commits

...

2 commits

Author SHA1 Message Date
Vinicius Souza
f60a6f1204 chore(doc): add readme file 2024-08-08 15:10:22 +00:00
Vinicius Souza
dac9a26a3a feat: add docker db 2024-08-08 14:55:43 +00:00
3 changed files with 60 additions and 0 deletions

5
.env Normal file
View file

@ -0,0 +1,5 @@
WRSR_DATABASE_NAME="wsrs"
WRSR_DATABASE_USER="postgres"
WRSR_DATABASE_PASSWORD="123456789"
WRSR_DATABASE_PORT=5432
WRSR_DATABASE_HOST="localhost"

24
README.md Normal file
View file

@ -0,0 +1,24 @@
# Introduction
This project aims to create a AMA style page using `react` on frontend and `go` on backend.
## Initialize project
```bash
$ go mod init forgejo.home.viniciussouza.me/learning/go-react-server
```
## Database migrations
### Installing tern
```bash
$ go install github.com/jackc/tern/v2@latest
```
### Creating migrations
```bash
$ tern new --migrations ./internal/store/pgstore/migrations create_rooms_table
$ tern new --migrations ./internal/store/pgstore/migrations create_messages_table
```

31
compose.yml Normal file
View file

@ -0,0 +1,31 @@
services:
db:
image: postgres:latest
restart: unless-stopped
ports:
- ${WRSR_DATABASE_PORT:-5432}:5432
environment:
POSTGRES_USER: ${WRSR_DATABASE_USER}
POSTGRES_PASSWORD: ${WRSR_DATABASE_PASSWORD}
POSTGRES_DB: ${WRSR_DATABASE_NAME}
volumes:
- db:/var/lib/postgresql/data
pgadmin:
image: dpage/pgadmin4:latest
restart: unless-stopped
depends_on:
- db
ports:
- 8081:80
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: password
volumes:
- pgadmin:/var/lib/pgadmin
volumes:
db:
driver: local
pgadmin:
driver: local