Updated makefile/dockerfile/compose files

This commit is contained in:
2023-12-19 16:16:30 -05:00
parent 0b4145ac30
commit 6f002856c1
10 changed files with 78 additions and 69 deletions

View File

@@ -1,15 +1,15 @@
RUST_LOG=warn,service=info RUST_LOG=warn,service=info
DATABASE_USER=weather DATABASE_USER=aviation
DATABASE_PASSWORD= DATABASE_PASSWORD=
DATABASE_NAME=weather DATABASE_NAME=aviation
DATABASE_HOST=db DATABASE_HOST=db
DATABASE_PORT=5432 DATABASE_PORT=5432
REDIS_HOST=redis REDIS_HOST=redis
REDIS_PORT=6379 REDIS_PORT=6379
MINIO_ROOT_USER=weather MINIO_ROOT_USER=aviation
MINIO_ROOT_PASSWORD= MINIO_ROOT_PASSWORD=
MINIO_HOST=localhost MINIO_HOST=localhost
MINIO_PORT=9000 MINIO_PORT=9000

View File

@@ -1,9 +1,10 @@
#!make #!make
SHELL := /bin/bash
GIT_HASH ?= $(shell git log --format="%h" -n 1)
include .env include .env
SHELL := /bin/bash
.PHONY: help build start stop lint .PHONY: help build start stop lint
help: ## This info help: ## This info
@@ -12,7 +13,7 @@ help: ## This info
@echo @echo
build: ## Build Docker containers build: ## Build Docker containers
docker compose build export TAG=${GIT_HASH} && docker compose build
up: ## Start Docker containers up: ## Start Docker containers
docker compose up -d docker compose up -d
@@ -22,10 +23,10 @@ down: ## Stop Docker containers
clean: ## Cleanup Docker containers clean: ## Cleanup Docker containers
docker compose down && \ docker compose down && \
docker image rm weather-ui || \ docker image rm aviation-ui || \
docker image rm weather-service || \ docker image rm aviation-service || \
docker network rm weather-frontend || \ docker network rm aviation-frontend || \
docker network rm weather-backend docker network rm aviation-backend
generate: ## Generate RSA keys generate: ## Generate RSA keys
mkdir keys mkdir keys

View File

@@ -1,10 +1,10 @@
version: '3' version: '3'
name: weather name: aviation
services: services:
db: db:
image: postgis/postgis:latest image: postgis/postgis:latest
container_name: weather-db container_name: aviation-db
env_file: env_file:
- .env - .env
environment: environment:
@@ -19,19 +19,19 @@ services:
networks: networks:
- backend - backend
restart: unless-stopped restart: unless-stopped
redis: redis:
image: redis:latest image: redis:latest
container_name: weather-redis container_name: aviation-redis
volumes:
- redis:/data
ports: ports:
- ${REDIS_PORT:-6379}:6379 - ${REDIS_PORT:-6379}:6379
networks: networks:
- backend - backend
restart: unless-stopped restart: unless-stopped
minio: minio:
image: minio/minio image: minio/minio
container_name: weather-minio container_name: aviation-minio
environment: environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
@@ -46,25 +46,30 @@ services:
restart: unless-stopped restart: unless-stopped
service: service:
container_name: weather-service container_name: aviation-service
env_file: env_file:
- .env - .env
environment:
KEYS_DIR_PATH: /keys
volumes: volumes:
- ${KEYS_DIR_PATH}:/keys - ${KEYS_DIR_PATH}:/keys
ports: ports:
- "${SERVICE_PORT:-5000}:5000" - "${SERVICE_PORT:-5000}:5000"
build: build:
context: service context: service
tags:
- aviation-service:${TAG:-latest}
depends_on: depends_on:
- db - db
- redis - redis
- minio
networks: networks:
- frontend - frontend
- backend - backend
restart: unless-stopped restart: unless-stopped
ui: ui:
container_name: weather-ui container_name: aviation-ui
env_file: env_file:
- .env - .env
environment: environment:
@@ -73,6 +78,8 @@ services:
- ${UI_PORT:-3000}:3000 - ${UI_PORT:-3000}:3000
build: build:
context: ui context: ui
tags:
- aviation-ui:${TAG:-latest}
depends_on: depends_on:
- service - service
networks: networks:
@@ -82,6 +89,7 @@ services:
volumes: volumes:
db: db:
db_logs: db_logs:
redis:
minio: minio:
networks: networks:

View File

@@ -1,10 +1,10 @@
RUST_LOG=warn,service=debug RUST_LOG=warn,service=debug
DATABASE_CONTAINER=weather-service DATABASE_CONTAINER=aviation-service
DATABASE_USER=weather DATABASE_USER=aviation
DATABASE_PASSWORD= DATABASE_PASSWORD=
DATABASE_NAME=weather DATABASE_NAME=aviation
DATABASE_HOST=localhost DATABASE_HOST=localhost
DATABASE_PORT=5432 DATABASE_PORT=5432
@@ -12,7 +12,7 @@ REDIS_HOST=localhost
REDIS_PORT=6379 REDIS_PORT=6379
MINIO_ROOT_USER=weather MINIO_ROOT_USER=weather
MINIO_ROOT_PASSWORD=7LtSkxU15ix40nu MINIO_ROOT_PASSWORD=
MINIO_HOST=localhost MINIO_HOST=localhost
MINIO_PORT=9000 MINIO_PORT=9000
MINIO_PORT_INTERNAL=9001 MINIO_PORT_INTERNAL=9001

View File

@@ -1,6 +1,8 @@
#!make #!make
SHELL := /bin/bash SHELL := /bin/bash
GIT_HASH ?= $(shell git log --format="%h" -n 1)
include .env include .env
.PHONY: help build start stop lint .PHONY: help build start stop lint
@@ -11,7 +13,7 @@ help: ## This info
@echo @echo
build: ## Build the Docker image build: ## Build the Docker image
docker compose build export TAG=${GIT_HASH} && docker compose build
utils: ## Start the utils utils: ## Start the utils
docker compose up -d db docker compose up -d db
@@ -24,14 +26,14 @@ up: ## Start the Docker containers
down: ## Stop the Docker containers down: ## Stop the Docker containers
docker compose down docker compose down
connect: ## Connect to the Weather DB connect: ## Connect to the PSQL DB
docker exec -it ${DATABASE_CONTAINER} psql -U postgres docker exec -it ${DATABASE_CONTAINER} psql -U postgres
clean: ## Cleanup Docker containers clean: ## Cleanup Docker containers
docker compose down && \ docker compose down && \
docker image rm weather-service || \ docker image rm aviation-service || \
docker network rm weather-frontend || \ docker network rm aviation-frontend || \
docker network rm weather-backend docker network rm aviation-backend
clean-db: ## Remove database 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}\";"' docker exec -i ${DATABASE_CONTAINER} sh -c 'PGPASSWORD=${DATABASE_PASSWORD} psql -U ${DATABASE_USER} -d postgres -c "DROP DATABASE IF EXISTS \"${DATABASE_NAME}\";"'

View File

@@ -1,10 +1,10 @@
version: '3' version: '3'
name: weather name: aviation
services: services:
db: db:
image: postgis/postgis:latest image: postgis/postgis:latest
container_name: weather-db container_name: aviation-db
env_file: env_file:
- .env - .env
environment: environment:
@@ -21,7 +21,7 @@ services:
restart: unless-stopped restart: unless-stopped
redis: redis:
image: redis:latest image: redis:latest
container_name: weather-redis container_name: aviation-redis
volumes: volumes:
- redis:/data - redis:/data
ports: ports:
@@ -31,7 +31,7 @@ services:
restart: unless-stopped restart: unless-stopped
minio: minio:
image: minio/minio image: minio/minio
container_name: weather-minio container_name: aviation-minio
environment: environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
@@ -46,7 +46,7 @@ services:
restart: unless-stopped restart: unless-stopped
service: service:
container_name: weather-service container_name: aviation-service
env_file: env_file:
- .env - .env
environment: environment:
@@ -63,9 +63,12 @@ services:
- "${SERVICE_PORT:-5000}:5000" - "${SERVICE_PORT:-5000}:5000"
build: build:
context: . context: .
tags:
- aviation-service:${TAG:-latest}
depends_on: depends_on:
- db - db
- redis - redis
- minio
networks: networks:
- frontend - frontend
- backend - backend

View File

@@ -1,7 +1,10 @@
#!make #!make
SHELL := /bin/bash SHELL := /bin/bash
GIT_HASH ?= $(shell git log --format="%h" -n 1)
include .env
.PHONY: help build start stop lint .PHONY: help build start stop lint
help: ## This info help: ## This info
@@ -10,7 +13,7 @@ help: ## This info
@echo @echo
build: ## Install the dependencies and build build: ## Install the dependencies and build
docker compose build export TAG=${GIT_HASH} && docker compose build
up: ## Start the dev instance up: ## Start the dev instance
docker compose up -d docker compose up -d
@@ -23,4 +26,4 @@ lint: ## Run the linter
clean: ## Remove node modules clean: ## Remove node modules
docker compose down && \ docker compose down && \
docker image rm weather-ui docker image rm aviation-ui

View File

@@ -1,9 +1,9 @@
version: '3' version: '3'
name: weather name: aviation
services: services:
ui: ui:
container_name: weather-ui container_name: aviation-ui
env_file: env_file:
- .env - .env
environment: environment:
@@ -13,6 +13,8 @@ services:
build: build:
context: ./ context: ./
target: dev target: dev
tags:
- aviation-ui:${TAG:-latest}
command: "npm run dev" command: "npm run dev"
volumes: volumes:
- ./src:/app/src - ./src:/app/src

View File

@@ -8,19 +8,15 @@ export default function CreateAirportPanel() {
initialValues: { initialValues: {
icao: '', icao: '',
category: AirportCategory.SMALL, category: AirportCategory.SMALL,
full_name: '', name: '',
elevation_ft: 0, elevation_ft: 0,
iso_country: '', iso_country: '',
iso_region: '', iso_region: '',
municipality: '', municipality: '',
gps_code: '',
iata_code: '', iata_code: '',
local_code: '', local_code: '',
point: { latitude: 0,
x: 0, longitude: 0,
y: 0,
srid: 4326
}
} }
}); });
@@ -46,6 +42,11 @@ export default function CreateAirportPanel() {
{ value: AirportCategory.SMALL, label: 'Small' }, { value: AirportCategory.SMALL, label: 'Small' },
{ value: AirportCategory.MEDIUM, label: 'Medium' }, { value: AirportCategory.MEDIUM, label: 'Medium' },
{ value: AirportCategory.LARGE, label: 'Large' }, { 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')} {...form.getInputProps('category')}
/> />
@@ -53,7 +54,7 @@ export default function CreateAirportPanel() {
required required
label='Full Name' label='Full Name'
placeholder='Manassas Regional Airport/Harry P. Davis Field' placeholder='Manassas Regional Airport/Harry P. Davis Field'
{...form.getInputProps('full_name')} {...form.getInputProps('name')}
/> />
<TextInput <TextInput
required required
@@ -82,12 +83,6 @@ export default function CreateAirportPanel() {
/> />
</Group> </Group>
<Group> <Group>
<TextInput
required
label='GPS Code'
placeholder='KHEF'
{...form.getInputProps('gps_code')}
/>
<TextInput <TextInput
label='IATA Code' label='IATA Code'
placeholder='MNZ' placeholder='MNZ'
@@ -104,13 +99,13 @@ export default function CreateAirportPanel() {
required required
label='Latitude' label='Latitude'
placeholder='38.72140121' placeholder='38.72140121'
{...form.getInputProps('point.x')} {...form.getInputProps('latitude')}
/> />
<TextInput <TextInput
required required
label='Longitude' label='Longitude'
placeholder='-77.51540375' placeholder='-77.51540375'
{...form.getInputProps('point.y')} {...form.getInputProps('longitude')}
/> />
</Group> </Group>
<Flex justify={'end'} mt={'sm'}> <Flex justify={'end'} mt={'sm'}>

View File

@@ -9,19 +9,15 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A
initialValues: { initialValues: {
icao: airport?.icao || '', icao: airport?.icao || '',
category: airport?.category || AirportCategory.SMALL, category: airport?.category || AirportCategory.SMALL,
full_name: airport?.full_name || '', name: airport?.name || '',
elevation_ft: airport?.elevation_ft || 0, elevation_ft: airport?.elevation_ft || 0,
iso_country: airport?.iso_country || '', iso_country: airport?.iso_country || '',
iso_region: airport?.iso_region || '', iso_region: airport?.iso_region || '',
municipality: airport?.municipality || '', municipality: airport?.municipality || '',
gps_code: airport?.gps_code || '',
iata_code: airport?.iata_code || '', iata_code: airport?.iata_code || '',
local_code: airport?.local_code || '', local_code: airport?.local_code || '',
point: { latitude: airport?.latitude || 0,
x: airport?.point.x || 0, longitude: airport?.longitude || 0,
y: airport?.point.y || 0,
srid: airport?.point.srid || 4326
}
} }
}); });
@@ -56,6 +52,11 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A
{ value: AirportCategory.SMALL, label: 'Small' }, { value: AirportCategory.SMALL, label: 'Small' },
{ value: AirportCategory.MEDIUM, label: 'Medium' }, { value: AirportCategory.MEDIUM, label: 'Medium' },
{ value: AirportCategory.LARGE, label: 'Large' }, { 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')} {...form.getInputProps('category')}
/> />
@@ -63,7 +64,7 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A
required required
label='Full Name' label='Full Name'
placeholder='Manassas Regional Airport/Harry P. Davis Field' placeholder='Manassas Regional Airport/Harry P. Davis Field'
{...form.getInputProps('full_name')} {...form.getInputProps('name')}
/> />
<TextInput <TextInput
required required
@@ -92,12 +93,6 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A
/> />
</Group> </Group>
<Group> <Group>
<TextInput
required
label='GPS Code'
placeholder='KHEF'
{...form.getInputProps('gps_code')}
/>
<TextInput <TextInput
required required
label='IATA Code' label='IATA Code'
@@ -116,13 +111,13 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A
required required
label='Latitude' label='Latitude'
placeholder='38.72140121' placeholder='38.72140121'
{...form.getInputProps('point.x')} {...form.getInputProps('latitude')}
/> />
<TextInput <TextInput
required required
label='Longitude' label='Longitude'
placeholder='-77.51540375' placeholder='-77.51540375'
{...form.getInputProps('point.y')} {...form.getInputProps('longitude')}
/> />
</Group> </Group>
<Flex justify={'end'} mt={'sm'}> <Flex justify={'end'} mt={'sm'}>