Tweaked makefiles/docker files
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
RUST_LOG=debug,actix=warn,diesel_migrations=warn,reqwest=warn,hyper=warn
|
||||
|
||||
DATABASE_CONTAINER=weather-db
|
||||
DATABASE_HOST=db
|
||||
DATABASE_USER=
|
||||
DATABASE_USER=weather
|
||||
DATABASE_PASSWORD=
|
||||
DATABASE_NAME=weather
|
||||
DATABASE_PORT=5432
|
||||
SERVICE_HOST=localhost
|
||||
|
||||
SERVICE_HOST=service
|
||||
SERVICE_PORT=5000
|
||||
|
||||
UI_PORT=3000
|
||||
NODE_ENV=development
|
||||
6
Makefile
6
Makefile
@@ -11,13 +11,13 @@ help: ## This info
|
||||
@cat Makefile | grep -E '^[a-zA-Z\/_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
@echo
|
||||
|
||||
build: ## Build Docker service container
|
||||
build: ## Build Docker containers
|
||||
docker compose build
|
||||
|
||||
up: ## Start Docker service containers
|
||||
up: ## Start Docker containers
|
||||
docker compose up -d
|
||||
|
||||
down: ## Stop Docker service containers
|
||||
down: ## Stop Docker containers
|
||||
docker compose down
|
||||
|
||||
connect: ## Connect to the Weather DB
|
||||
|
||||
@@ -15,7 +15,7 @@ services:
|
||||
- db:/var/lib/postgresql/data
|
||||
- db_logs:/var/log
|
||||
ports:
|
||||
- "${DATABASE_PORT}:5432"
|
||||
- "${DATABASE_PORT:-5432}:5432"
|
||||
networks:
|
||||
- weather-backend
|
||||
restart: unless-stopped
|
||||
@@ -25,7 +25,7 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "${SERVICE_PORT}:5000"
|
||||
- "${SERVICE_PORT:-5000}:5000"
|
||||
build:
|
||||
context: service
|
||||
depends_on:
|
||||
@@ -40,9 +40,9 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- NODE_ENV=${NODE_ENV}
|
||||
- NODE_ENV=${NODE_ENV:-production}
|
||||
ports:
|
||||
- ${UI_PORT}:3000
|
||||
- ${UI_PORT:-3000}:3000
|
||||
build:
|
||||
context: ui
|
||||
depends_on:
|
||||
|
||||
@@ -18,7 +18,8 @@ lazy_static! {
|
||||
let password = env::var("DATABASE_PASSWORD").expect("Database password is not set");
|
||||
let host = env::var("DATABASE_HOST").expect("Database host is not set");
|
||||
let name = env::var("DATABASE_NAME").expect("Database name is not set");
|
||||
let port = env::var("DATABASE_PORT").expect("Database port is not set");
|
||||
// let port = env::var("DATABASE_PORT").expect("Database port is not set");
|
||||
let port = 5432;
|
||||
let url = format!("postgres://{}:{}@{}:{}/{}", username, password, host, port, name);
|
||||
let manager = ConnectionManager::<PgConnection>::new(url);
|
||||
Pool::builder().test_on_check_out(true).build(manager).expect("Failed to create db pool")
|
||||
|
||||
5
ui/.env.TEMPLATE
Normal file
5
ui/.env.TEMPLATE
Normal file
@@ -0,0 +1,5 @@
|
||||
SERVICE_HOST=service
|
||||
SERVICE_PORT=5000
|
||||
|
||||
UI_PORT=8080
|
||||
NODE_ENV=development
|
||||
16
ui/Makefile
16
ui/Makefile
@@ -9,18 +9,18 @@ help: ## This info
|
||||
@cat Makefile | grep -E '^[a-zA-Z\/_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
@echo
|
||||
|
||||
install: ## Install the dependencies
|
||||
npm install
|
||||
|
||||
build: ## Install the dependencies and build
|
||||
npm run build
|
||||
docker compose build
|
||||
|
||||
start: ## Start the dev instance
|
||||
npm install
|
||||
npm run dev
|
||||
up: ## Start the dev instance
|
||||
docker compose up -d
|
||||
|
||||
down: ## Stop the dev instance
|
||||
docker compose down
|
||||
|
||||
lint: ## Run the linter
|
||||
npm run lint
|
||||
|
||||
clean: ## Remove node modules
|
||||
rm -rf node_modules
|
||||
docker compose down && \
|
||||
docker image rm weather-ui
|
||||
Reference in New Issue
Block a user