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