diff --git a/air.toml b/air.toml new file mode 100644 index 0000000..1ee3b71 --- /dev/null +++ b/air.toml @@ -0,0 +1,36 @@ +root = "." +test_data_dir = "testdata" +tmp_dir = "tmp" + +[build] + bin = "./tmp/main" + cmd = "go build -o ./tmp/main ./cmd/api" + delay = 1000 + exclude_dir = ["assets", "tmp", "vendor", "tests"] + exclude_file = [] + exclude_regex = ["_test.go"] + exclude_unchanged = false + follow_symlink = false + full_bin = "" + include_dir = [] + include_ext = ["go", "tpl", "tmpl", "html"] + kill_delay = "0s" + log = "build-errors.log" + send_interrupt = false + stop_on_error = true + +[color] + app = "" + build = "yellow" + main = "magenta" + runner = "green" + watcher = "cyan" + +[log] + time = false + +[misc] + clean_on_exit = false + +[screen] + clear_on_rebuild = false diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..8fe4506 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,57 @@ +services: + db: + image: postgres:16-alpine + container_name: ghj-db-dev + environment: + POSTGRES_USER: user + POSTGRES_PASSWORD: password + POSTGRES_DB: gohorsejobs + ports: + - "5432:5432" + volumes: + - ghj-db-dev-data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U user -d gohorsejobs"] + interval: 5s + timeout: 5s + retries: 5 + + backend: + image: cosmtrek/air + container_name: ghj-backend-dev + working_dir: /app + ports: + - "8521:8521" + environment: + - DATABASE_URL=postgresql://user:password@db:5432/gohorsejobs?sslmode=disable + - JWT_SECRET=rede5-secret-key-at-least-32-chars-long + - PASSWORD_PEPPER=rede5-pepper + - COOKIE_SECRET=rede5-cookie-secret + - ENV=development + - BACKEND_PORT=8521 + - CORS_ORIGINS=https://ghj.rede5.com.br,http://localhost:3000 + volumes: + - ./backend:/app + - ./air.toml:/app/.air.toml + depends_on: + db: + condition: service_healthy + command: -c .air.toml + + frontend: + image: node:22-alpine + container_name: ghj-frontend-dev + working_dir: /app + ports: + - "3000:3000" + environment: + - NEXT_PUBLIC_API_URL=https://api-ghj.rede5.com.br/api/v1 + - NODE_ENV=development + volumes: + - ./frontend:/app + depends_on: + - backend + command: sh -c "npm install && npm run dev" + +volumes: + ghj-db-dev-data: diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..821313f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,27 @@ +server { + listen 80; + server_name ghj.rede5.com.br; + + location / { + proxy_pass http://172.18.0.4:3000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } +} + +server { + listen 80; + server_name api-ghj.rede5.com.br; + + location / { + proxy_pass http://172.18.0.3:8521; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } +}