Skip to content

Commit a78894c

Browse files
author
Tom Softreck
committed
aktualizacja przykladow
1 parent 7e06ef1 commit a78894c

File tree

14 files changed

+144
-2
lines changed

14 files changed

+144
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.idea
2+
venv
3+
.env
4+
.venv
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.11-slim
2+
WORKDIR /app
3+
COPY requirements.txt .
4+
RUN pip install -r requirements.txt
5+
COPY . .
6+
EXPOSE 5000
7+
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ Jak używać Traefik jako zaawansowanego reverse proxy Jak konfigurować service
1414

1515
## Krok 1: Przygotowanie środowiska
1616

17-
### Instalacja podstawowych narzędzi
17+
### Sprawdzenie narzędzi
1818
```bash
19-
# Zaktualizuj system
19+
podman info
20+
podman-compose --version
21+
docker compose version
22+
```
23+
24+
### Instalacja podstawowych narzędzi na debian, Ubuntu
25+
```bash
26+
# Zaktualizuj system
2027
sudo apt update && sudo apt upgrade -y
2128

2229
# Zainstaluj Podman
@@ -29,8 +36,34 @@ pip3 install podman-compose
2936
sudo apt install docker-compose-plugin -y
3037
```
3138

39+
### Instalacja podstawowych narzędzi na Fedora
40+
41+
```bash
42+
# Zaktualizuj system
43+
sudo dnf upgrade --refresh -y
44+
45+
# Zainstaluj Podman
46+
sudo dnf install podman -y
47+
48+
# Zainstaluj podman-compose (potrzebne do docker-compose.yml)
49+
pip3 install --user podman-compose
50+
51+
# Upewnij się, że ~/.local/bin jest w PATH (jeśli nie, dodaj do ~/.bashrc lub ~/.zshrc)
52+
export PATH=$HOME/.local/bin:$PATH
53+
54+
# (Opcjonalnie) Zainstaluj docker-compose-plugin z Dockerem
55+
sudo dnf install dnf-plugins-core -y
56+
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
57+
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
58+
59+
# (Opcjonalnie) Włącz Docker jeśli został zainstalowany
60+
sudo systemctl enable --now docker
61+
```
62+
3263
---
3364

65+
66+
3467
## Krok 2: Struktura projektu
3568

3669
```bash

debian/caddy.sh

Whitespace-only changes.

debian/podman.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
# Potrzebujesz docker-compose lub podman-compose
3+
sudo apt install docker-compose-plugin
4+
# lub
5+
pip install podman-compose

deploy.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Array projektów
4+
projects=("projekt1" "projekt2")
5+
base_port=5001
6+
7+
# Build i uruchomienie każdego projektu
8+
for i in "${!projects[@]}"; do
9+
project=${projects[i]}
10+
port=$((base_port + i))
11+
12+
echo "Deploying $project on port $port..."
13+
14+
cd ~/$project
15+
podman build -t $project .
16+
podman stop $project 2>/dev/null || true
17+
podman rm $project 2>/dev/null || true
18+
podman run -d --name $project -p $port:5000 $project
19+
20+
echo "$project deployed on port $port"
21+
done

docker-compose.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: '3.8'
2+
3+
services:
4+
traefik:
5+
image: traefik:v2.10
6+
command:
7+
- "--api.insecure=true"
8+
- "--providers.docker=true"
9+
- "--providers.docker.exposedbydefault=false"
10+
- "--entrypoints.web.address=:80"
11+
- "--entrypoints.websecure.address=:443"
12+
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
13+
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
14+
15+
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
16+
ports:
17+
- "8080:8080" # Traefik dashboard
18+
- "8081:80" # HTTP traffic
19+
- "8443:443" # HTTPS traffic
20+
volumes:
21+
- "/var/run/docker.sock:/var/run/docker.sock:ro"
22+
- "./letsencrypt:/letsencrypt"
23+
restart: unless-stopped
24+
25+
projekt1:
26+
build: ./projekt1
27+
labels:
28+
- "traefik.enable=true"
29+
- "traefik.http.routers.projekt1.rule=Host(`projekt1.localhost`)"
30+
- "traefik.http.routers.projekt1.entrypoints=web"
31+
- "traefik.http.services.projekt1.loadbalancer.server.port=5000"
32+
restart: unless-stopped
33+
34+
projekt2:
35+
build: ./projekt2
36+
labels:
37+
- "traefik.enable=true"
38+
- "traefik.http.routers.projekt2.rule=Host(`projekt2.localhost`)"
39+
- "traefik.http.routers.projekt2.entrypoints=web"
40+
- "traefik.http.services.projekt2.loadbalancer.server.port=5000"
41+
restart: unless-stopped
42+

fedora/caddy.sh

Whitespace-only changes.

fedora/podman.sh

Whitespace-only changes.

projekt1/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.9-slim
2+
3+
WORKDIR /app
4+
5+
COPY requirements.txt .
6+
RUN pip install --no-cache-dir -r requirements.txt
7+
8+
COPY . .
9+
10+
EXPOSE 5000
11+
12+
CMD ["python", "app.py"]

0 commit comments

Comments
 (0)