diff --git a/.env.TEMPLATE b/.env.TEMPLATE index 7475297..dc39679 100644 --- a/.env.TEMPLATE +++ b/.env.TEMPLATE @@ -1,15 +1,15 @@ RUST_LOG=warn,service=info -DATABASE_USER=weather +DATABASE_USER=aviation DATABASE_PASSWORD= -DATABASE_NAME=weather +DATABASE_NAME=aviation DATABASE_HOST=db DATABASE_PORT=5432 REDIS_HOST=redis REDIS_PORT=6379 -MINIO_ROOT_USER=weather +MINIO_ROOT_USER=aviation MINIO_ROOT_PASSWORD= MINIO_HOST=localhost MINIO_PORT=9000 diff --git a/Makefile b/Makefile index 5f5a113..ed7d77c 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ #!make +SHELL := /bin/bash + +GIT_HASH ?= $(shell git log --format="%h" -n 1) include .env -SHELL := /bin/bash - .PHONY: help build start stop lint help: ## This info @@ -12,7 +13,7 @@ help: ## This info @echo build: ## Build Docker containers - docker compose build + export TAG=${GIT_HASH} && docker compose build up: ## Start Docker containers docker compose up -d @@ -22,10 +23,10 @@ down: ## Stop Docker containers clean: ## Cleanup Docker containers docker compose down && \ - docker image rm weather-ui || \ - docker image rm weather-service || \ - docker network rm weather-frontend || \ - docker network rm weather-backend + docker image rm aviation-ui || \ + docker image rm aviation-service || \ + docker network rm aviation-frontend || \ + docker network rm aviation-backend generate: ## Generate RSA keys mkdir keys diff --git a/docker-compose.yml b/docker-compose.yml index cd7f34f..de49880 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ version: '3' -name: weather +name: aviation services: db: image: postgis/postgis:latest - container_name: weather-db + container_name: aviation-db env_file: - .env environment: @@ -19,19 +19,19 @@ services: networks: - backend restart: unless-stopped - redis: image: redis:latest - container_name: weather-redis + container_name: aviation-redis + volumes: + - redis:/data ports: - ${REDIS_PORT:-6379}:6379 networks: - backend restart: unless-stopped - minio: image: minio/minio - container_name: weather-minio + container_name: aviation-minio environment: MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} @@ -46,25 +46,30 @@ services: restart: unless-stopped service: - container_name: weather-service + container_name: aviation-service env_file: - .env + environment: + KEYS_DIR_PATH: /keys volumes: - ${KEYS_DIR_PATH}:/keys ports: - "${SERVICE_PORT:-5000}:5000" build: context: service + tags: + - aviation-service:${TAG:-latest} depends_on: - db - redis + - minio networks: - frontend - backend restart: unless-stopped ui: - container_name: weather-ui + container_name: aviation-ui env_file: - .env environment: @@ -73,6 +78,8 @@ services: - ${UI_PORT:-3000}:3000 build: context: ui + tags: + - aviation-ui:${TAG:-latest} depends_on: - service networks: @@ -82,6 +89,7 @@ services: volumes: db: db_logs: + redis: minio: networks: diff --git a/service/.env.TEMPLATE b/service/.env.TEMPLATE index c1013dc..b282fef 100644 --- a/service/.env.TEMPLATE +++ b/service/.env.TEMPLATE @@ -1,10 +1,10 @@ RUST_LOG=warn,service=debug -DATABASE_CONTAINER=weather-service +DATABASE_CONTAINER=aviation-service -DATABASE_USER=weather +DATABASE_USER=aviation DATABASE_PASSWORD= -DATABASE_NAME=weather +DATABASE_NAME=aviation DATABASE_HOST=localhost DATABASE_PORT=5432 @@ -12,7 +12,7 @@ REDIS_HOST=localhost REDIS_PORT=6379 MINIO_ROOT_USER=weather -MINIO_ROOT_PASSWORD=7LtSkxU15ix40nu +MINIO_ROOT_PASSWORD= MINIO_HOST=localhost MINIO_PORT=9000 MINIO_PORT_INTERNAL=9001 diff --git a/service/Makefile b/service/Makefile index 1051e48..e7d35b6 100644 --- a/service/Makefile +++ b/service/Makefile @@ -1,6 +1,8 @@ #!make SHELL := /bin/bash +GIT_HASH ?= $(shell git log --format="%h" -n 1) + include .env .PHONY: help build start stop lint @@ -11,7 +13,7 @@ help: ## This info @echo build: ## Build the Docker image - docker compose build + export TAG=${GIT_HASH} && docker compose build utils: ## Start the utils docker compose up -d db @@ -24,14 +26,14 @@ up: ## Start the Docker containers down: ## Stop the Docker containers docker compose down -connect: ## Connect to the Weather DB +connect: ## Connect to the PSQL DB docker exec -it ${DATABASE_CONTAINER} psql -U postgres clean: ## Cleanup Docker containers docker compose down && \ - docker image rm weather-service || \ - docker network rm weather-frontend || \ - docker network rm weather-backend + docker image rm aviation-service || \ + docker network rm aviation-frontend || \ + docker network rm aviation-backend clean-db: ## Remove database docker exec -i ${DATABASE_CONTAINER} sh -c 'PGPASSWORD=${DATABASE_PASSWORD} psql -U ${DATABASE_USER} -d postgres -c "DROP DATABASE IF EXISTS \"${DATABASE_NAME}\";"' diff --git a/service/docker-compose.yml b/service/docker-compose.yml index 95408da..18331f7 100644 --- a/service/docker-compose.yml +++ b/service/docker-compose.yml @@ -1,10 +1,10 @@ version: '3' -name: weather +name: aviation services: db: image: postgis/postgis:latest - container_name: weather-db + container_name: aviation-db env_file: - .env environment: @@ -21,7 +21,7 @@ services: restart: unless-stopped redis: image: redis:latest - container_name: weather-redis + container_name: aviation-redis volumes: - redis:/data ports: @@ -31,7 +31,7 @@ services: restart: unless-stopped minio: image: minio/minio - container_name: weather-minio + container_name: aviation-minio environment: MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} @@ -46,7 +46,7 @@ services: restart: unless-stopped service: - container_name: weather-service + container_name: aviation-service env_file: - .env environment: @@ -63,9 +63,12 @@ services: - "${SERVICE_PORT:-5000}:5000" build: context: . + tags: + - aviation-service:${TAG:-latest} depends_on: - db - redis + - minio networks: - frontend - backend diff --git a/ui/Makefile b/ui/Makefile index 9539687..8076b0f 100644 --- a/ui/Makefile +++ b/ui/Makefile @@ -1,7 +1,10 @@ #!make - SHELL := /bin/bash +GIT_HASH ?= $(shell git log --format="%h" -n 1) + +include .env + .PHONY: help build start stop lint help: ## This info @@ -10,7 +13,7 @@ help: ## This info @echo build: ## Install the dependencies and build - docker compose build + export TAG=${GIT_HASH} && docker compose build up: ## Start the dev instance docker compose up -d @@ -23,4 +26,4 @@ lint: ## Run the linter clean: ## Remove node modules docker compose down && \ - docker image rm weather-ui \ No newline at end of file + docker image rm aviation-ui \ No newline at end of file diff --git a/ui/docker-compose.yml b/ui/docker-compose.yml index 672d5a7..2912ffa 100644 --- a/ui/docker-compose.yml +++ b/ui/docker-compose.yml @@ -1,9 +1,9 @@ version: '3' -name: weather +name: aviation services: ui: - container_name: weather-ui + container_name: aviation-ui env_file: - .env environment: @@ -13,6 +13,8 @@ services: build: context: ./ target: dev + tags: + - aviation-ui:${TAG:-latest} command: "npm run dev" volumes: - ./src:/app/src diff --git a/ui/src/components/Admin/CreateAirportPanel.tsx b/ui/src/components/Admin/CreateAirportPanel.tsx index 04f4836..93383bc 100644 --- a/ui/src/components/Admin/CreateAirportPanel.tsx +++ b/ui/src/components/Admin/CreateAirportPanel.tsx @@ -8,19 +8,15 @@ export default function CreateAirportPanel() { initialValues: { icao: '', category: AirportCategory.SMALL, - full_name: '', + name: '', elevation_ft: 0, iso_country: '', iso_region: '', municipality: '', - gps_code: '', iata_code: '', local_code: '', - point: { - x: 0, - y: 0, - srid: 4326 - } + latitude: 0, + longitude: 0, } }); @@ -46,6 +42,11 @@ export default function CreateAirportPanel() { { value: AirportCategory.SMALL, label: 'Small' }, { value: AirportCategory.MEDIUM, label: 'Medium' }, { value: AirportCategory.LARGE, label: 'Large' }, + { value: AirportCategory.HELIPORT, label: 'Heliport' }, + { value: AirportCategory.CLOSED, label: 'Closed' }, + { value: AirportCategory.SEAPLANE, label: 'Seaplane Base' }, + { value: AirportCategory.BALLOONPORT, label: 'Balloonport' }, + { value: AirportCategory.UNKNOWN, label: 'Unknown'} ]} {...form.getInputProps('category')} /> @@ -53,7 +54,7 @@ export default function CreateAirportPanel() { required label='Full Name' placeholder='Manassas Regional Airport/Harry P. Davis Field' - {...form.getInputProps('full_name')} + {...form.getInputProps('name')} /> - diff --git a/ui/src/components/Admin/UpdateAirportModal.tsx b/ui/src/components/Admin/UpdateAirportModal.tsx index 8293725..730b424 100644 --- a/ui/src/components/Admin/UpdateAirportModal.tsx +++ b/ui/src/components/Admin/UpdateAirportModal.tsx @@ -9,19 +9,15 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A initialValues: { icao: airport?.icao || '', category: airport?.category || AirportCategory.SMALL, - full_name: airport?.full_name || '', + name: airport?.name || '', elevation_ft: airport?.elevation_ft || 0, iso_country: airport?.iso_country || '', iso_region: airport?.iso_region || '', municipality: airport?.municipality || '', - gps_code: airport?.gps_code || '', iata_code: airport?.iata_code || '', local_code: airport?.local_code || '', - point: { - x: airport?.point.x || 0, - y: airport?.point.y || 0, - srid: airport?.point.srid || 4326 - } + latitude: airport?.latitude || 0, + longitude: airport?.longitude || 0, } }); @@ -56,6 +52,11 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A { value: AirportCategory.SMALL, label: 'Small' }, { value: AirportCategory.MEDIUM, label: 'Medium' }, { value: AirportCategory.LARGE, label: 'Large' }, + { value: AirportCategory.HELIPORT, label: 'Heliport' }, + { value: AirportCategory.CLOSED, label: 'Closed' }, + { value: AirportCategory.SEAPLANE, label: 'Seaplane Base' }, + { value: AirportCategory.BALLOONPORT, label: 'Balloonport' }, + { value: AirportCategory.UNKNOWN, label: 'Unknown'} ]} {...form.getInputProps('category')} /> @@ -63,7 +64,7 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A required label='Full Name' placeholder='Manassas Regional Airport/Harry P. Davis Field' - {...form.getInputProps('full_name')} + {...form.getInputProps('name')} /> -