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
2 changes: 1 addition & 1 deletion auth/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func runServe(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

if viper.GetString("app.env") == "prod" {
if viper.GetString("app.env") == "prod" || viper.GetString("app.env") == "dev" {
hostName = serviceName
} else {
hostName = "localhost"
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
pickfighter-gateway-service:
command: ["serve", "gateway", "--env", "dev"]
auth-service:
command: ["serve", "auth", "--env", "dev"]
fighters-service:
command: ["serve", "fighters", "--env", "dev"]
events-service:
command: ["serve", "events", "--env", "dev"]
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
services:
services:
db:
container_name: pickfighter-db
build:
Expand Down
42 changes: 7 additions & 35 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
services:
db:
container_name: pickfighter-db
build:
context: .
dockerfile: migrations/init/Dockerfile
volumes:
- postgres:/var/lib/postgresql/data/pgdata
expose:
- "5432"
environment:
PGDATA: "/var/lib/postgresql/data/pgdata"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: ${DB_PASS}
POSTGRES_DB: "pickfighter"
POSTGRES_HOST_AUTH_METHOD: "trust"
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
networks:
- pickfighter_network

redis:
image: redis
container_name: dev-redis
Expand All @@ -41,6 +17,8 @@ services:
- redis
environment:
- REDIS_URL=redis:6379
ports:
- "9091:9091"
networks:
- pickfighter_network

Expand All @@ -52,10 +30,9 @@ services:
dockerfile: auth/Dockerfile
depends_on:
- redis
- db
environment:
- REDIS_URL=redis:6379
- DB_URL=postgres://postgres@db:5432/pickfighter
- DB_URL=postgres://postgres:greedisgood@172.17.0.1:5432/pickfighter_db
expose:
- "9092"
networks:
Expand All @@ -70,10 +47,9 @@ services:
dockerfile: fighters/Dockerfile
depends_on:
- redis
- db
environment:
- REDIS_URL=redis:6379
- DB_URL=postgres://postgres@db:5432/pickfighter
- DB_URL=postgres://postgres:greedisgood@172.17.0.1:5432/pickfighter_db
expose:
- "9093"
networks:
Expand All @@ -87,10 +63,9 @@ services:
dockerfile: events/Dockerfile
depends_on:
- redis
- db
environment:
- REDIS_URL=redis:6379
- DB_URL=postgres://postgres@db:5432/pickfighter
- DB_URL=postgres://postgres:greedisgood@172.17.0.1:5432/pickfighter_db
expose:
- "9094"
networks:
Expand All @@ -102,7 +77,7 @@ services:
volumes:
- ./nginx/nginx.local.conf:/etc/nginx/nginx.conf:ro
ports:
- "8081:80"
- "8081:8081"
depends_on:
- pickfighter-gateway-service
networks:
Expand All @@ -111,7 +86,4 @@ services:
networks:
pickfighter_network:
name: pickfighter_network
driver: bridge

volumes:
postgres:
driver: bridge
2 changes: 1 addition & 1 deletion events/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func runServe(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

if viper.GetString("app.env") == "prod" {
if viper.GetString("app.env") == "prod" || viper.GetString("app.env") == "dev" {
hostName = serviceName
} else {
hostName = "localhost"
Expand Down
2 changes: 1 addition & 1 deletion fighters/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func runServe(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

if viper.GetString("app.env") == "prod" {
if viper.GetString("app.env") == "prod" || viper.GetString("app.env") == "dev" {
hostName = serviceName
} else {
hostName = "localhost"
Expand Down
2 changes: 1 addition & 1 deletion migrations/init/auth_service_init.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c pickfighter
\c pickfighter;

-- Create the users table
CREATE TABLE IF NOT EXISTS auth.users (
Expand Down
2 changes: 1 addition & 1 deletion migrations/init/events_service_init.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c pickfighter
\c pickfighter;

-- Queries to create tables
CREATE TABLE IF NOT EXISTS events.bets (
Expand Down
2 changes: 1 addition & 1 deletion migrations/init/fighters_service_init.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c pickfighter
\c pickfighter;

-- Create tables
CREATE TABLE IF NOT EXISTS fighters.divisions (
Expand Down
2 changes: 1 addition & 1 deletion pickfighter/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func runServe(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

if viper.GetString("app.env") == "prod" {
if viper.GetString("app.env") == "prod" || viper.GetString("app.env") == "dev" {
hostName = serviceName
} else {
hostName = "localhost"
Expand Down
2 changes: 2 additions & 0 deletions pickfighter/internal/handler/http/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ func (h *Handler) CreateEvent(w http.ResponseWriter, r *http.Request) {
if err != nil {
// TODO handle errors from service
httplib.ErrorResponseJSON(w, http.StatusBadRequest, internalErr.Events, err)
return
}

result := httplib.SuccessfulResult()
Expand All @@ -345,6 +346,7 @@ func (h *Handler) GetEvents(w http.ResponseWriter, r *http.Request) {
if err != nil {
// TODO handle errors from service
httplib.ErrorResponseJSON(w, http.StatusBadRequest, internalErr.Events, err)
return
}

httplib.ResponseJSON(w, httplib.ListResult{
Expand Down
4 changes: 4 additions & 0 deletions scripts/cfg_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ FILES_TO_BACKUP=(
".env"
"auth/configs/config.dev.yaml"
"auth/configs/config.prod.yaml"
"auth/configs/config.local.yaml"
"events/configs/config.dev.yaml"
"events/configs/config.prod.yaml"
"events/configs/config.local.yaml"
"fighters/configs/config.dev.yaml"
"fighters/configs/config.prod.yaml"
"fighters/configs/config.local.yaml"
"pickfighter/configs/config.dev.yaml"
"pickfighter/configs/config.prod.yaml"
"pickfighter/configs/config.local.yaml"
"scraper/configs/proxy.yaml"
"auth/logs/log.json"
"events/logs/log.json"
Expand Down
Loading