diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48986fd..7f0d887 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,9 +8,9 @@ repos: rev: 6.1.0 hooks: - id: flake8 - args: [--config, flights-domain/setup.cfg] + args: [--config, flights-domain/flights-information/setup.cfg] - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: - id: isort - args: ['--src-path', 'flights-domain/'] + args: ['--src-path', 'flights-domain/', 'auth-domain/user-manager/'] diff --git a/auth-domain/user-manager/manage.py b/auth-domain/user-manager/manage.py index ae8af41..39aa98a 100644 --- a/auth-domain/user-manager/manage.py +++ b/auth-domain/user-manager/manage.py @@ -1,8 +1,6 @@ from flask.cli import FlaskGroup - -from src import create_app, db -from src.api.models.users import User - +from src import create_app, db +from src.api.models.users import User app = create_app() cli = FlaskGroup(create_app=create_app) diff --git a/browser-domain/Dockerfile.prod b/browser-domain/Dockerfile.prod index d1c093d..b84f0fb 100644 --- a/browser-domain/Dockerfile.prod +++ b/browser-domain/Dockerfile.prod @@ -1,8 +1,13 @@ FROM node:17.9.1 AS app -ENV REACT_APP_ENDPOINT "https://api.fids.slc.ar/" WORKDIR /app +COPY package.json /app/package.json +RUN npm install COPY . . -RUN npm install && npm run build + +ARG REACT_APP_ENDPOINT +ENV REACT_APP_ENDPOINT $REACT_APP_ENDPOINT + +RUN npm run build FROM nginx:alpine WORKDIR /usr/share/nginx/html diff --git a/browser-domain/docker-compose.yml b/browser-domain/docker-compose.yml new file mode 100644 index 0000000..b93ff25 --- /dev/null +++ b/browser-domain/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' + +services: + client: + container_name: fids_browser_client + image: ${CLIENT_IMAGE} + restart: always + ports: + - 8080:80 + environment: + - API_HOST=api + network_mode: host diff --git a/db/Dockerfile b/flights-domain/db/Dockerfile similarity index 100% rename from db/Dockerfile rename to flights-domain/db/Dockerfile diff --git a/db/create.sql b/flights-domain/db/create.sql similarity index 100% rename from db/create.sql rename to flights-domain/db/create.sql diff --git a/docker-compose.yml b/flights-domain/docker-compose.yml similarity index 63% rename from docker-compose.yml rename to flights-domain/docker-compose.yml index f2ca73c..907b863 100644 --- a/docker-compose.yml +++ b/flights-domain/docker-compose.yml @@ -2,12 +2,9 @@ version: '3.8' services: - api: - container_name: fids_api + flights-api: + container_name: fids_flights_api image: ${API_IMAGE} - profiles: - - api - - all ports: - 5000:5000 healthcheck: @@ -19,20 +16,17 @@ services: environment: - TEST_TARGET=${TEST_TARGET} - PORT=5000 - - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@api-db/${POSTGRES_DB} + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@flights-api-db/${POSTGRES_DB} - APP_SETTINGS=${APP_SETTINGS} depends_on: - api-db: + flights-api-db: condition: service_healthy - api-db: - container_name: fids_api_db + flights-api-db: + container_name: fids_flights_db build: context: ./db dockerfile: Dockerfile - profiles: - - api - - all healthcheck: test: psql postgres --command "select 1" -U ${POSTGRES_USER} interval: 2s @@ -44,18 +38,3 @@ services: environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASS} - - client: - container_name: fids_client - image: ${CLIENT_IMAGE} - profiles: - - client - - all - restart: always - ports: - - 8080:80 - depends_on: - api: - condition: service_healthy - environment: - - API_HOST=api diff --git a/flights-domain/.bandit.yml b/flights-domain/flights-information/.bandit.yml similarity index 100% rename from flights-domain/.bandit.yml rename to flights-domain/flights-information/.bandit.yml diff --git a/flights-domain/.coveragerc b/flights-domain/flights-information/.coveragerc similarity index 100% rename from flights-domain/.coveragerc rename to flights-domain/flights-information/.coveragerc diff --git a/flights-domain/.gitignore b/flights-domain/flights-information/.gitignore similarity index 100% rename from flights-domain/.gitignore rename to flights-domain/flights-information/.gitignore diff --git a/flights-domain/Dockerfile.prod b/flights-domain/flights-information/Dockerfile.prod similarity index 100% rename from flights-domain/Dockerfile.prod rename to flights-domain/flights-information/Dockerfile.prod diff --git a/flights-domain/Dockerfile.prod.dockerignore b/flights-domain/flights-information/Dockerfile.prod.dockerignore similarity index 100% rename from flights-domain/Dockerfile.prod.dockerignore rename to flights-domain/flights-information/Dockerfile.prod.dockerignore diff --git a/flights-domain/Dockerfile.test b/flights-domain/flights-information/Dockerfile.test similarity index 100% rename from flights-domain/Dockerfile.test rename to flights-domain/flights-information/Dockerfile.test diff --git a/flights-domain/Pipfile b/flights-domain/flights-information/Pipfile similarity index 100% rename from flights-domain/Pipfile rename to flights-domain/flights-information/Pipfile diff --git a/flights-domain/entrypoint.sh b/flights-domain/flights-information/entrypoint.sh similarity index 100% rename from flights-domain/entrypoint.sh rename to flights-domain/flights-information/entrypoint.sh diff --git a/flights-domain/requirements.test.txt b/flights-domain/flights-information/requirements.test.txt similarity index 100% rename from flights-domain/requirements.test.txt rename to flights-domain/flights-information/requirements.test.txt diff --git a/flights-domain/requirements.txt b/flights-domain/flights-information/requirements.txt similarity index 100% rename from flights-domain/requirements.txt rename to flights-domain/flights-information/requirements.txt diff --git a/flights-domain/setup.cfg b/flights-domain/flights-information/setup.cfg similarity index 100% rename from flights-domain/setup.cfg rename to flights-domain/flights-information/setup.cfg diff --git a/flights-domain/src/.cicd/test.sh b/flights-domain/flights-information/src/.cicd/test.sh similarity index 100% rename from flights-domain/src/.cicd/test.sh rename to flights-domain/flights-information/src/.cicd/test.sh diff --git a/flights-domain/src/api/cruds/flight.py b/flights-domain/flights-information/src/api/cruds/flight.py similarity index 99% rename from flights-domain/src/api/cruds/flight.py rename to flights-domain/flights-information/src/api/cruds/flight.py index afbeb38..b0dc5e4 100644 --- a/flights-domain/src/api/cruds/flight.py +++ b/flights-domain/flights-information/src/api/cruds/flight.py @@ -1,6 +1,5 @@ from sqlalchemy.orm import Session from sqlalchemy.sql import func - from src.api.models.flight import Flight from src.api.schemas.flight import Flight as FlightPydantic diff --git a/flights-domain/src/api/db.py b/flights-domain/flights-information/src/api/db.py similarity index 100% rename from flights-domain/src/api/db.py rename to flights-domain/flights-information/src/api/db.py diff --git a/flights-domain/src/api/main.py b/flights-domain/flights-information/src/api/main.py similarity index 87% rename from flights-domain/src/api/main.py rename to flights-domain/flights-information/src/api/main.py index 0051029..89f5cd6 100644 --- a/flights-domain/src/api/main.py +++ b/flights-domain/flights-information/src/api/main.py @@ -1,6 +1,5 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware - from src.api.db import Base, engine from src.api.routes import flights, health @@ -14,6 +13,9 @@ app.add_middleware( allow_origins=[ "https://fids.slc.ar", "http://localhost:8080", + "http://localhost", + "http://localhost:80", + "http://localhost:81", "http://localhost:3000", ], allow_credentials=True, diff --git a/flights-domain/src/api/models/flight.py b/flights-domain/flights-information/src/api/models/flight.py similarity index 99% rename from flights-domain/src/api/models/flight.py rename to flights-domain/flights-information/src/api/models/flight.py index 4c7d999..aff61fe 100644 --- a/flights-domain/src/api/models/flight.py +++ b/flights-domain/flights-information/src/api/models/flight.py @@ -1,6 +1,5 @@ from sqlalchemy import Column, DateTime, Integer, String from sqlalchemy.sql import func - from src.api.db import Base diff --git a/flights-domain/src/api/routes/flights.py b/flights-domain/flights-information/src/api/routes/flights.py similarity index 99% rename from flights-domain/src/api/routes/flights.py rename to flights-domain/flights-information/src/api/routes/flights.py index 262ee84..ef1fdb2 100644 --- a/flights-domain/src/api/routes/flights.py +++ b/flights-domain/flights-information/src/api/routes/flights.py @@ -2,7 +2,6 @@ from typing import Optional from fastapi import APIRouter, Depends, HTTPException from sqlalchemy.orm import Session - from src.api.cruds import flight as flight_crud from src.api.db import get_db from src.api.schemas.flight import Flight, FlightCreate, FlightStatusUpdate diff --git a/flights-domain/src/api/routes/health.py b/flights-domain/flights-information/src/api/routes/health.py similarity index 100% rename from flights-domain/src/api/routes/health.py rename to flights-domain/flights-information/src/api/routes/health.py diff --git a/flights-domain/src/api/schemas/flight.py b/flights-domain/flights-information/src/api/schemas/flight.py similarity index 100% rename from flights-domain/src/api/schemas/flight.py rename to flights-domain/flights-information/src/api/schemas/flight.py diff --git a/flights-domain/src/config.py b/flights-domain/flights-information/src/config.py similarity index 100% rename from flights-domain/src/config.py rename to flights-domain/flights-information/src/config.py diff --git a/flights-domain/src/tests/dummy_test.py b/flights-domain/flights-information/src/tests/dummy_test.py similarity index 99% rename from flights-domain/src/tests/dummy_test.py rename to flights-domain/flights-information/src/tests/dummy_test.py index 454fab8..1177ac0 100644 --- a/flights-domain/src/tests/dummy_test.py +++ b/flights-domain/flights-information/src/tests/dummy_test.py @@ -1,5 +1,4 @@ from fastapi.testclient import TestClient - from src.api.main import Flight, app, flight_instance client = TestClient(app) diff --git a/screen-domain/Dockerfile.prod b/screen-domain/Dockerfile.prod index d1c093d..1f9c13e 100644 --- a/screen-domain/Dockerfile.prod +++ b/screen-domain/Dockerfile.prod @@ -1,8 +1,14 @@ FROM node:17.9.1 AS app -ENV REACT_APP_ENDPOINT "https://api.fids.slc.ar/" WORKDIR /app +COPY package.json /app/package.json +RUN npm -v && ls -al +RUN npm install COPY . . -RUN npm install && npm run build + +ARG REACT_APP_ENDPOINT +ENV REACT_APP_ENDPOINT $REACT_APP_ENDPOINT + +RUN npm run build FROM nginx:alpine WORKDIR /usr/share/nginx/html diff --git a/screen-domain/docker-compose.yml b/screen-domain/docker-compose.yml new file mode 100644 index 0000000..0a5a763 --- /dev/null +++ b/screen-domain/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' + +services: + screens-client: + container_name: fids_screens_client + image: ${CLIENT_IMAGE} + restart: always + ports: + - 8080:80 + environment: + - API_HOST=api + network_mode: host diff --git a/screen-domain/nginx/default.conf b/screen-domain/nginx/default.conf index 702aebb..68b03e3 100644 --- a/screen-domain/nginx/default.conf +++ b/screen-domain/nginx/default.conf @@ -1,5 +1,5 @@ server { - listen 80; + listen 81; location / { root /usr/share/nginx/html; index unresolvable-file-html.html;