corrected compose.yml and add podman docs

This commit is contained in:
deffcolony 2025-04-22 17:12:36 +02:00
parent 292ce42cd7
commit 7013f26eb2
2 changed files with 96 additions and 11 deletions

View File

@ -3,20 +3,20 @@ services:
build: build:
context: . context: .
dockerfile: ./docker/nginx/Dockerfile dockerfile: ./docker/nginx/Dockerfile
container_name: vichan_frontend container_name: vichan_web
restart: unless-stopped restart: unless-stopped
ports:
- "9090:80"
# - "9092:443" # optional for SSL
depends_on:
- db
- php
volumes: volumes:
- ./local-instances/${INSTANCE:-0}/www:/var/www/html - ./local-instances/${INSTANCE:-0}/www:/var/www/html
- ./docker/nginx/vichan.conf:/etc/nginx/conf.d/default.conf - ./docker/nginx/vichan.conf:/etc/nginx/conf.d/default.conf
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/proxy.conf:/etc/nginx/conf.d/proxy.conf - ./docker/nginx/proxy.conf:/etc/nginx/conf.d/proxy.conf
# - ./docker/nginx/ssl:/etc/nginx/ssl # optional For SSL # - ./docker/nginx/ssl:/etc/nginx/ssl # optional For SSL
ports:
- "9090:80"
# - "9092:443" # optional for SSL
depends_on:
- db
- php
links: links:
- php - php
@ -71,6 +71,8 @@ services:
image: mariadb:latest image: mariadb:latest
container_name: vichan_mariadb container_name: vichan_mariadb
restart: unless-stopped restart: unless-stopped
volumes:
- ./local-instances/${INSTANCE:-0}/db:/var/lib/mysql
ports: ports:
- "9091:3306" - "9091:3306"
environment: environment:
@ -78,17 +80,15 @@ services:
MYSQL_USER: ${MYSQL_USER} MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- ./local-instances/${INSTANCE:-0}/db:/var/lib/mysql
redis: redis:
image: redis:latest image: redis:latest
container_name: vichan_redis container_name: vichan_redis
restart: unless-stopped restart: unless-stopped
environment:
REDIS_PASSWORD: ${VICHAN_REDIS_PASSWORD}
volumes: volumes:
- ./local-instances/${INSTANCE:-0}/redis:/data - ./local-instances/${INSTANCE:-0}/redis:/data
environment:
REDIS_PASSWORD: ${VICHAN_REDIS_PASSWORD}
command: redis-server --requirepass ${VICHAN_REDIS_PASSWORD} command: redis-server --requirepass ${VICHAN_REDIS_PASSWORD}
healthcheck: healthcheck:
test: ["CMD", "redis-cli", "-a", "${VICHAN_REDIS_PASSWORD}", "ping"] test: ["CMD", "redis-cli", "-a", "${VICHAN_REDIS_PASSWORD}", "ping"]

View File

@ -61,3 +61,88 @@ Environment variables for the Docker Compose setup can be managed easily using a
- Redis connection details - Redis connection details
- Secure login - Secure login
- Optional SSL certificate paths for nginx - Optional SSL certificate paths for nginx
# Vichan Podman Setup (Docker alternative)
**Podman** offers a daemonless, rootless alternative for running Vichan in containers. Podman is API-compatible with Docker, allowing you to use the existing `compose.yml` file with minimal changes, while providing a more secure and lightweight environment.
This tutorial is for administrators who prefer to avoid Docker, addressing security concerns and ensuring a robust Vichan install.
---
## Why Podman?
- **Daemonless**: Unlike Docker, Podman doesnt require a central daemon, reducing the attack surface and eliminating the need for a privileged process.
- **Rootless**: Podman runs containers as a non-root user by default, improving security by limiting the impact of potential container escapes.
- **Lightweight**: Podman has a smaller footprint and is better suited for environments where simplicity and security are priorities.
- **Docker Compatibility**: Podman supports Docker Compose files via Podman Compose, making it easy to adapt the existing Vichan setup.
Learn more at: https://podman.io
---
## Prerequisites
**Install Podman**
The official installation tutorial can be found at: https://podman.io/docs/installation
**Configure the `.env` file** as described in the main setup guide (copy `.env.example` to `.env` and update passwords).
---
## Steps to Run Vichan with Podman
### 1. Prepare File Permissions
Since Podman runs rootless, ensure the `local-instances/1/db` and `local-instances/1/www` directories are writable by your user:
```bash
chmod -R u+rw local-instances/1
```
If using SELinux (e.g., on Fedora), you may need to set the correct context:
```bash
chcon -R -t container_file_t local-instances/1
```
### 2. Start Containers with Podman Compose
Run the following command from the root of the Vichan project directory to build and start all containers:
```bash
podman-compose up -d --build
```
This command mirrors `docker compose up -d --build` but uses Podmans container engine.
### 3. Rebuild Specific Containers
To rebuild only the PHP container (e.g., during development):
```bash
podman-compose up -d --build php
```
---
## Managing Podman Containers
**List running containers:**
```bash
podman ps
```
**Stop all containers:**
```bash
podman-compose down
```
**View logs for a specific service (e.g., PHP):**
```bash
podman logs vichan_php
```