Migrated project into separate directories
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,7 +1,7 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
@@ -36,5 +36,4 @@ yarn-error.log*
|
||||
|
||||
target/
|
||||
dist/
|
||||
/data/
|
||||
.env
|
||||
*.env
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:latest
|
||||
container_name: aviation_weather_db
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgress}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-aviation_weather}
|
||||
volumes:
|
||||
- ./data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
restart: unless-stopped
|
||||
8926
package-lock.json
generated
8926
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
48
backend/Cargo.lock → weather-service/Cargo.lock
generated
48
backend/Cargo.lock → weather-service/Cargo.lock
generated
@@ -269,30 +269,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "aviation-weather-backend"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-cors",
|
||||
"actix-rt",
|
||||
"actix-web",
|
||||
"chrono",
|
||||
"diesel",
|
||||
"diesel_migrations",
|
||||
"dotenv",
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
"listenfd",
|
||||
"log",
|
||||
"quick-xml",
|
||||
"r2d2",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"uuid 1.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.69"
|
||||
@@ -1846,6 +1822,30 @@ version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
|
||||
|
||||
[[package]]
|
||||
name = "weather-service"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-cors",
|
||||
"actix-rt",
|
||||
"actix-web",
|
||||
"chrono",
|
||||
"diesel",
|
||||
"diesel_migrations",
|
||||
"dotenv",
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
"listenfd",
|
||||
"log",
|
||||
"quick-xml",
|
||||
"r2d2",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"uuid 1.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.64"
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "aviation-weather-backend"
|
||||
name = "weather-service"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
29
weather-service/Makefile
Normal file
29
weather-service/Makefile
Normal file
@@ -0,0 +1,29 @@
|
||||
#!make
|
||||
|
||||
include .env
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
.PHONY: help build start stop lint
|
||||
|
||||
help: ## This info
|
||||
@echo
|
||||
@cat Makefile | grep -E '^[a-zA-Z\/_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
@echo
|
||||
|
||||
up:
|
||||
docker compose up -d
|
||||
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
connect:
|
||||
docker exec -it aviation_weather_db psql -U postgres
|
||||
|
||||
lint: ## Run the linter
|
||||
npm run lint
|
||||
|
||||
clean-db: ## Remove database and Cargo packages
|
||||
docker exec -i ${DATABASE_HOST} sh -c 'PGPASSWORD=${DATABASE_PASSWORD} psql -U ${DATABASE_USER} -d postgres -c "DROP DATABASE IF EXISTS \"${DATABASE_NAME}\";"' || true
|
||||
|
||||
|
||||
22
weather-service/docker-compose.yml
Normal file
22
weather-service/docker-compose.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:latest
|
||||
container_name: weather.db
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
POSTGRES_USER: ${DATABASE_USER}
|
||||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
|
||||
POSTGRES_DB: ${DATABASE_NAME}
|
||||
volumes:
|
||||
- db_weather:/var/lib/postgresql/data
|
||||
- db_logs_weather:/var/log
|
||||
ports:
|
||||
- "5433:5432"
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
db_weather:
|
||||
db_logs_weather:
|
||||
@@ -1,4 +1,4 @@
|
||||
CREATE TABLE "airports" (
|
||||
CREATE TABLE IF NOT EXISTS airports (
|
||||
id SERIAL PRIMARY KEY,
|
||||
full_name TEXT NOT NULL,
|
||||
icao TEXT NOT NULL,
|
||||
@@ -1,4 +1,4 @@
|
||||
CREATE TABLE "metars" (
|
||||
CREATE TABLE IF NOT EXISTS metars (
|
||||
id SERIAL PRIMARY KEY,
|
||||
icao TEXT NOT NULL,
|
||||
raw_text TEXT NOT NULL,
|
||||
@@ -13,8 +13,11 @@ diesel_migrations::embed_migrations!();
|
||||
|
||||
lazy_static! {
|
||||
static ref POOL: Pool = {
|
||||
let db_url = env::var("DATABASE_URL").expect("Database url not set");
|
||||
let manager = ConnectionManager::<PgConnection>::new(db_url);
|
||||
let username = env::var("DATABASE_USER").expect("Database username is not set");
|
||||
let password = env::var("DATABASE_PASSWORD").expect("Database password is not set");
|
||||
let name = env::var("DATABASE_NAME").expect("Database name is not set");
|
||||
let url = format!("postgres://{}:{}@localhost:5433/{}", username, password, name);
|
||||
let manager = ConnectionManager::<PgConnection>::new(url);
|
||||
Pool::new(manager).expect("Failed to create db pool")
|
||||
};
|
||||
}
|
||||
0
Cargo.lock → weather-ui/Cargo.lock
generated
0
Cargo.lock → weather-ui/Cargo.lock
generated
@@ -16,19 +16,11 @@ build: ## Install the dependencies and build
|
||||
npm run build
|
||||
|
||||
start: ## Start the dev instance
|
||||
npm install
|
||||
npm run dev
|
||||
|
||||
up:
|
||||
docker compose up -d
|
||||
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
connect:
|
||||
docker exec -it aviation_weather_db psql -U postgres
|
||||
|
||||
lint: ## Run the linter
|
||||
npm run lint
|
||||
|
||||
clean: ## Remove node modules
|
||||
rm -rf data node_modules backend/target
|
||||
rm -rf node_modules
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user