Fix compose file

This commit is contained in:
myrmidex 2025-07-27 21:08:23 +02:00
parent 861d469082
commit 502d84cc37
4 changed files with 50 additions and 70 deletions

View file

@ -20,12 +20,12 @@ LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=incr
DB_USERNAME=incr_user
DB_PASSWORD=incr_password
SESSION_DRIVER=database
SESSION_LIFETIME=120

View file

@ -46,68 +46,24 @@ ### Quick Start (Production)
#### Docker
Create a `docker-compose.yml` file:
```yaml
services:
app:
image: codeberg.org/lvl0/incr:0.1.14
container_name: incr-app
restart: unless-stopped
working_dir: /var/www/html
environment:
- APP_ENV=production
- APP_DEBUG=false
- DB_CONNECTION=mysql
- DB_HOST=db
- DB_PORT=3306
- DB_DATABASE=incr
- DB_USERNAME=incr_user
- DB_PASSWORD=incr_password
volumes:
- ./storage:/var/www/html/storage
- ./public:/var/www/html/public
ports:
- "80:80"
depends_on:
- db
networks:
- incr-network
db:
image: mysql:8.0
container_name: incr-db
restart: unless-stopped
environment:
- MYSQL_DATABASE=incr
- MYSQL_USER=incr_user
- MYSQL_PASSWORD=incr_password
- MYSQL_ROOT_PASSWORD=root_password
volumes:
- db_data:/var/lib/mysql
ports:
- "3306:3306"
networks:
- incr-network
networks:
incr-network:
driver: bridge
volumes:
db_data:
driver: local
```
Then run:
Clone the repository and run with Docker Compose:
```bash
docker compose up -d
git clone https://github.com/your-username/incr.git
cd incr
```
The application will be available at `http://localhost`.
Run the application using the provided docker-compose configuration:
**Default credentials**: You'll need to register a new account on first visit.
```bash
# Using Docker Compose
docker-compose -f docker/docker-compose.yml up --build
# Or using Podman Compose
podman-compose -f docker/docker-compose.yml up --build
```
The application will be available at `http://localhost:5001`.
### Development

View file

@ -2,7 +2,10 @@ version: '3.8'
services:
app:
image: codeberg.org/lvl0/incr:0.1.14
# image: codeberg.org/lvl0/incr:latest
build:
context: ..
dockerfile: docker/Dockerfile
container_name: incr-app
restart: unless-stopped
working_dir: /var/www/html
@ -15,18 +18,17 @@ services:
- DB_DATABASE=incr
- DB_USERNAME=incr_user
- DB_PASSWORD=incr_password
volumes:
- ../storage:/var/www/html/storage
- ../public:/var/www/html/public
volumes: []
ports:
- "80:80"
- "5001:80"
depends_on:
- db
db:
condition: service_healthy
networks:
- incr-network
db:
image: mysql:8.0
image: docker.io/library/mysql:8.0
container_name: incr-db
restart: unless-stopped
environment:
@ -38,6 +40,12 @@ services:
- db_data:/var/lib/mysql
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "incr_user", "-pincr_password"]
timeout: 10s
retries: 10
interval: 10s
start_period: 10s
networks:
- incr-network

View file

@ -3,6 +3,22 @@
# Copy public files to shared volume if needed
cp -r /var/www/html/public/. /var/www/html/public_shared/ 2>/dev/null || true
# Create .env file if it doesn't exist
if [ ! -f /var/www/html/.env ]; then
cp /var/www/html/.env.example /var/www/html/.env 2>/dev/null || touch /var/www/html/.env
fi
# Wait for database to be ready
echo "Waiting for database..."
until php artisan tinker --execute="DB::connection()->getPdo();" 2>/dev/null; do
echo "Database not ready, waiting..."
sleep 2
done
echo "Database is ready!"
# Generate app key if not set
php artisan key:generate --force
# Laravel optimizations
php artisan config:cache
php artisan route:cache