Add all files to repository
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# Frontend environments
|
||||
VITE_PORT =
|
||||
VITE_API_BASE_URL =
|
||||
VITE_API_WS_URL =
|
||||
VITE_SECURITY_CODE =
|
||||
|
||||
# Backend environments
|
||||
DEBUG =
|
||||
SECRET_KEY =
|
||||
ALLOWED_HOSTS =
|
||||
PER_PAGE_SIZE =
|
||||
# Database
|
||||
MYSQL_PORT=
|
||||
DATABASE_NAME =
|
||||
DATABASE_USER =
|
||||
DATABASE_PASSWORD =
|
||||
DATABASE_HOST =
|
||||
|
||||
DJANGO_SUPERUSER_USERNAME =
|
||||
DJANGO_SUPERUSER_EMAIL =
|
||||
DJANGO_SUPERUSER_PASSWORD =
|
||||
|
||||
# Redis
|
||||
REDIS_PORT =
|
||||
|
||||
# Watchtower
|
||||
WATCHTOWER_HTTP_API_TOKEN =
|
||||
UPDATE_HOOK_TOKEN =
|
||||
WATCHTOWER_URL =
|
||||
|
||||
# Registry Images
|
||||
FRONTEND_IMAGE =
|
||||
BACKEND_IMAGE =
|
||||
RELEASE_API_URL =
|
||||
@@ -0,0 +1 @@
|
||||
.env
|
||||
@@ -0,0 +1,41 @@
|
||||
# Setup Project on Mini PC (Windows)
|
||||
|
||||
In the `scripts` folder there are several `.bat` files used to set up the environment on the mini PC.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Create an `Apps` folder on the `C` drive.
|
||||
- Clone this repository into the `Apps` directory. Note that should not rename the directory you have just cloned.
|
||||
|
||||
## Steps
|
||||
|
||||
1. **Update and rename `.env.template` file to `.env`**
|
||||
|
||||
2. **Run `setup-wsl.bat`**
|
||||
- This will install WSL with Ubuntu‑22.04.
|
||||
- Follow the prompts to create a default UNIX user account inside WSL.
|
||||
|
||||
3. **Run `setup-docker.bat`**
|
||||
- This will install Docker Engine (v2) and Docker Compose V2 inside the Ubuntu WSL you just created.
|
||||
- It also enables the Docker daemon to start automatically.
|
||||
|
||||
4. **Run `setup-prj.bat`**
|
||||
- Login docker to Gitea.
|
||||
- Create `walmart` folder in WSL.
|
||||
- Copy `.env` and `compose` files to `walmart` folder.
|
||||
- Run docker compose file `docker compose up -d`.
|
||||
|
||||
5. **Run `update-prj.bat`**
|
||||
- This will pull latest image from container registry.
|
||||
- Restart all containers in compose file
|
||||
- Remove unused images (old images)
|
||||
|
||||
## Notes
|
||||
|
||||
- During these steps, you may be asked to enter your UNIX user password (for `sudo` commands).
|
||||
- Make sure you reboot your PC after running `setup-wsl.bat` before continuing with the next scripts.
|
||||
- Verify installation by running:
|
||||
```bash
|
||||
docker --version
|
||||
docker compose version
|
||||
```
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
services:
|
||||
|
||||
proxy:
|
||||
image: traefik:v2.11
|
||||
container_name: tv-proxy-prod
|
||||
restart: unless-stopped
|
||||
|
||||
command:
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedbydefault=false
|
||||
- --entrypoints.web.address=:3000
|
||||
- --api.insecure=true
|
||||
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
networks:
|
||||
- tv-network-prod
|
||||
|
||||
redis:
|
||||
image: redis:8.4.0-alpine
|
||||
container_name: tv-redis-prod
|
||||
restart: unless-stopped
|
||||
|
||||
ports:
|
||||
- "${REDIS_PORT}:6379"
|
||||
|
||||
volumes:
|
||||
- tv-redis-prod:/data
|
||||
|
||||
networks:
|
||||
- tv-network-prod
|
||||
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=false"
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: tv-db-prod
|
||||
restart: unless-stopped
|
||||
|
||||
ports:
|
||||
- "${MYSQL_PORT}:3306"
|
||||
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DATABASE_NAME}
|
||||
MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
|
||||
|
||||
volumes:
|
||||
- tv-data-prod:/var/lib/mysql
|
||||
|
||||
cap_add:
|
||||
- SYS_NICE
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
networks:
|
||||
- tv-network-prod
|
||||
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=false"
|
||||
|
||||
backend:
|
||||
image: ${BACKEND_IMAGE}
|
||||
|
||||
container_name: tv-backend-prod
|
||||
restart: unless-stopped
|
||||
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
networks:
|
||||
- tv-network-prod
|
||||
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.backend.rule=PathPrefix(`/api`) || PathPrefix(`/static`) || PathPrefix(`/admin`) || PathPrefix(`/ws`)"
|
||||
- "traefik.http.routers.backend.entrypoints=web"
|
||||
- "traefik.http.services.backend.loadbalancer.server.port=8000"
|
||||
|
||||
- "com.centurylinklabs.watchtower.enable=true"
|
||||
- "com.centurylinklabs.watchtower.lifecycle.post-update=/app/scripts/post-update.sh"
|
||||
|
||||
frontend:
|
||||
image: ${FRONTEND_IMAGE}
|
||||
|
||||
container_name: tv-frontend-prod
|
||||
restart: unless-stopped
|
||||
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
environment:
|
||||
- CHOKIDAR_USEPOLLING=False
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
networks:
|
||||
- tv-network-prod
|
||||
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.frontend.rule=PathPrefix(`/`)"
|
||||
- "traefik.http.routers.frontend.entrypoints=web"
|
||||
- "traefik.http.services.frontend.loadbalancer.server.port=80"
|
||||
|
||||
- "com.centurylinklabs.watchtower.enable=true"
|
||||
- "com.centurylinklabs.watchtower.lifecycle.post-update=/app/scripts/post-update.sh"
|
||||
|
||||
watchtower:
|
||||
image: containrrr/watchtower:1.7.1
|
||||
container_name: tv-watchtower-prod
|
||||
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /root/.docker/config.json:/config.json:ro
|
||||
|
||||
command:
|
||||
- --http-api-update
|
||||
- --cleanup
|
||||
- --no-startup-message
|
||||
|
||||
environment:
|
||||
- WATCHTOWER_HTTP_API_TOKEN=${WATCHTOWER_HTTP_API_TOKEN}
|
||||
- WATCHTOWER_LIFECYCLE_HOOKS=true
|
||||
|
||||
ports:
|
||||
- "8080:8080"
|
||||
|
||||
networks:
|
||||
- tv-network-prod
|
||||
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=false"
|
||||
|
||||
volumes:
|
||||
tv-data-prod:
|
||||
name: tv-data-prod
|
||||
|
||||
tv-redis-prod:
|
||||
name: tv-redis-prod
|
||||
|
||||
networks:
|
||||
tv-network-prod:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,22 @@
|
||||
@echo off
|
||||
echo Adding official Docker repository...
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg lsb-release"
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo install -m 0755 -d /etc/apt/keyrings"
|
||||
wsl -d Ubuntu-22.04 bash -c "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg"
|
||||
wsl -d Ubuntu-22.04 bash -c "echo 'deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable' | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null"
|
||||
|
||||
echo Installing Docker Engine 28.3.2 + Docker Compose V2...
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo apt-get update && sudo apt-get install -y docker-ce=5:28.3.2-1~ubuntu.22.04~jammy docker-ce-cli=5:28.3.2-1~ubuntu.22.04~jammy containerd.io docker-compose-plugin"
|
||||
|
||||
echo Holding Docker packages to prevent auto-upgrade...
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo apt-mark hold docker-ce docker-ce-cli containerd.io"
|
||||
|
||||
echo Enabling Docker daemon...
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo systemctl enable docker && sudo systemctl start docker"
|
||||
|
||||
echo ============================================
|
||||
echo Setup complete! Checking versions...
|
||||
wsl -d Ubuntu-22.04 bash -c "docker --version"
|
||||
wsl -d Ubuntu-22.04 bash -c "docker compose version"
|
||||
echo ============================================
|
||||
pause
|
||||
@@ -0,0 +1,27 @@
|
||||
@echo off
|
||||
REM ============================================
|
||||
REM Clone source code and start Docker Compose
|
||||
REM ============================================
|
||||
|
||||
echo Login docker
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo docker login gitea.digitoolsolutions.synology.me"
|
||||
|
||||
echo [1/3] Copying files into WSL...
|
||||
REM Create ~/walmart folder in WSL
|
||||
wsl -d Ubuntu-22.04 bash -c "mkdir -p ~/walmart"
|
||||
|
||||
REM Copy docker-compose.yml and .env from Windows to WSL
|
||||
wsl -d Ubuntu-22.04 bash -c "cp /mnt/c/Apps/mini-pc-setup/compose.yml ~/walmart/"
|
||||
wsl -d Ubuntu-22.04 bash -c "cp /mnt/c/Apps/mini-pc-setup/.env ~/walmart/"
|
||||
|
||||
echo [2/3] Starting containers...
|
||||
wsl -d Ubuntu-22.04 bash -c "cd ~/walmart && sudo docker compose up -d"
|
||||
|
||||
echo [3/3] Showing running containers...
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo docker ps"
|
||||
|
||||
echo ============================================
|
||||
echo Project 'walmart' is up and running!
|
||||
echo ============================================
|
||||
|
||||
pause
|
||||
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
echo Installing WSL with Ubuntu-22.04...
|
||||
wsl --install -d Ubuntu-22.04
|
||||
echo Please reboot your computer and create your Ubuntu user before continuing.
|
||||
pause
|
||||
@@ -0,0 +1,26 @@
|
||||
@echo off
|
||||
|
||||
echo ============================================
|
||||
echo Updating Walmart containers...
|
||||
echo ============================================
|
||||
|
||||
echo [1/4] Update config...
|
||||
wsl -d Ubuntu-22.04 bash -c "cp /mnt/c/Apps/mini-pc-setup/compose.yml ~/walmart/"
|
||||
wsl -d Ubuntu-22.04 bash -c "cp /mnt/c/Apps/mini-pc-setup/.env ~/walmart/"
|
||||
|
||||
echo [2/4] Pull latest images...
|
||||
wsl -d Ubuntu-22.04 bash -c "cd ~/walmart && sudo docker compose pull"
|
||||
|
||||
echo [3/4] Restart containers...
|
||||
wsl -d Ubuntu-22.04 bash -c "cd ~/walmart && sudo docker compose up -d"
|
||||
|
||||
echo [4/4] Remove unused images...
|
||||
wsl -d Ubuntu-22.04 bash -c "sudo docker image prune -af"
|
||||
|
||||
pause
|
||||
echo.
|
||||
echo ============================================
|
||||
echo Walmart update completed!
|
||||
echo ============================================
|
||||
|
||||
pause
|
||||
@@ -0,0 +1,119 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Kiosk Startup</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
font-family: sans-serif;
|
||||
background-color: #222;
|
||||
color: #fff;
|
||||
font-family: Roboto, sans-serif;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.loader-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 16px 0;
|
||||
gap: 12px;
|
||||
}
|
||||
.loader {
|
||||
width: 60px;
|
||||
aspect-ratio: 1;
|
||||
display: grid;
|
||||
color: #c92f31;
|
||||
background: radial-gradient(
|
||||
farthest-side,
|
||||
currentColor calc(100% - 6px),
|
||||
#0000 calc(100% - 5px) 0
|
||||
);
|
||||
-webkit-mask: radial-gradient(
|
||||
farthest-side,
|
||||
#0000 calc(100% - 13px),
|
||||
#000 calc(100% - 12px)
|
||||
);
|
||||
border-radius: 50%;
|
||||
animation: spin 3s infinite ease-in-out;
|
||||
}
|
||||
.loader::before,
|
||||
.loader::after {
|
||||
content: "";
|
||||
grid-area: 1/1;
|
||||
background:
|
||||
linear-gradient(currentColor 0 0) center,
|
||||
linear-gradient(currentColor 0 0) center;
|
||||
background-size:
|
||||
100% 12px,
|
||||
12px 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.loader::after {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
100% {
|
||||
transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
|
||||
.loader-text {
|
||||
width: fit-content;
|
||||
font-weight: bold;
|
||||
font-family: monospace;
|
||||
font-size: 30px;
|
||||
color: #0000;
|
||||
background: linear-gradient(90deg, #c92f31 calc(50% + 0.5ch), #000 0)
|
||||
right/calc(200% + 1ch) 100%;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
animation: l7 3s infinite steps(100);
|
||||
}
|
||||
.loader-text:before {
|
||||
content: "Loading...";
|
||||
}
|
||||
@keyframes l7 {
|
||||
to {
|
||||
background-position: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Welcome to DTS Torque Vault</h1>
|
||||
<div class="loader-container">
|
||||
<div class="loader"></div>
|
||||
<div class="loader-text"></div>
|
||||
</div>
|
||||
<p style="text-align: center">Loading system resources, please wait</p>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
async function checkBackend() {
|
||||
try {
|
||||
const res = await fetch(
|
||||
"http://localhost:3000/api/v1/health-check/",
|
||||
{ mode: "no-cors" },
|
||||
);
|
||||
window.location.href = "http://localhost:3000/";
|
||||
} catch (e) {
|
||||
setTimeout(checkBackend, 3000);
|
||||
}
|
||||
}
|
||||
setTimeout(checkBackend, 1000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user