Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions apps/pimcore/.env
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
W9_REPO=pimcore/pimcore
W9_DIST=community
# version refers to: https://github.com/pimcore/docker#image-flavors
W9_VERSION=php8.2-latest
W9_POWER_PASSWORD=uQ8E1wVTzG8SOk3!

W9_NAME=pimcore
W9_REPO=pimcore/pimcore
# Environments which for user settings when create application
W9_HTTP_PORT_SET=9001

# version refer to: https://github.com/pimcore/docker#image-flavors
W9_VERSION=php8.2-latest
#### -- Not allowed to edit below environments when recreate app based on existing data -- ####
W9_ID=pimcore
W9_HTTP_PORT=80
W9_LOGIN_USER=admin
W9_LOGIN_PASSWORD=$W9_POWER_PASSWORD
W9_DB_EXPOSE=mariadb
W9_DB_VERSION=10.11
W9_URL=internet_ip:$W9_HTTP_PORT_SET
W9_NETWORK=websoft9
W9_HTTP_PORT=9001

#### --------------------------------------------------------------------------------------- ####

W9_DB_PORT=3306
W9_DB_MYSQL_VERSION=5.7
W9_DB_MYSQL_PORT=3306
W9_DB_MYSQL_PASSWORD=$W9_POWER_PASSWORD
W9_DB_MYSQL_NAME=$W9_NAME
W9_DB_MYSQL_USER=$W9_NAME
# Pimcore database connection
PIMCORE_DB_HOST=$W9_ID-mariadb
PIMCORE_DB_NAME=$W9_ID
PIMCORE_DB_USER=$W9_ID
PIMCORE_DB_PASSWORD=$W9_POWER_PASSWORD
27 changes: 26 additions & 1 deletion apps/pimcore/Notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Pimcore

Can not used, need improve
## Architecture

This stack uses 3 long-running containers + 1 initialization container:

- **nginx**: Web server (nginx:stable-alpine), handles HTTP requests and proxies PHP to the `php` service
- **php**: PHP-FPM + background workers (`pimcore/pimcore:php8.2-supervisord-latest`)
- **mariadb**: MariaDB 10.11 database
- **init**: One-time setup container (`pimcore/pimcore:php8.2-latest`) that runs on first startup to install Pimcore via Composer and configure the database

## First Startup

On first `docker compose up -d`, the `init` container will:
1. Run `composer create-project pimcore/skeleton` to download Pimcore
2. Run `vendor/bin/pimcore-install` to initialize the database and create the admin user

This step can take **5–15 minutes** depending on network speed. The `php` and `nginx` containers will return errors until initialization completes. Monitor progress with:

```bash
docker logs -f pimcore-init
```

## References

- Official image: https://hub.docker.com/r/pimcore/pimcore
- Docker setup docs: https://github.com/pimcore/docker
- Pimcore skeleton: https://github.com/pimcore/skeleton
10 changes: 5 additions & 5 deletions apps/pimcore/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pimcore on Docker
# Pimcore on Docker

This is an **[Docker Compose template](https://github.com/Websoft9/docker-library)** powered by [Websoft9](https://www.websoft9.com) based on Docker for Pimcore :
This is an **[Docker Compose template](https://github.com/Websoft9/docker-library)** powered by [Websoft9](https://www.websoft9.com) based on Docker for Pimcore:


- community: php8.2-latest
Expand All @@ -17,10 +17,10 @@ The following are the minimal [recommended requirements](https://github.com/pimc

## Install

You can install this Pimcore by [How to use it?](https://github.com/Websoft9/docker-library#how-to-use-it).
You can install this Pimcore by [How to use it?](https://github.com/Websoft9/docker-library#how-to-use-it).

If you want use Pimcore with **Websoft9 Business Support** free, you can [subscribe Pimcore ](https://www.websoft9.com/apps) on Cloud platform
If you want use Pimcore with **Websoft9 Business Support** free, you can [subscribe Pimcore](https://www.websoft9.com/apps) on Cloud platform

## Documentation

[Pimcore Administrator Guide](https://support.websoft9.com/docs/pimcore) powered by Websoft9
[Pimcore Administrator Guide](https://support.websoft9.com/docs/pimcore) powered by Websoft9
102 changes: 51 additions & 51 deletions apps/pimcore/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
# docs1: https://pimcore.com/docs/platform/Pimcore/Getting_Started/Installation/Docker_Based_Installation/
# docs2: https://github.com/pimcore/docker
# image,docs: https://hub.docker.com/r/pimcore/pimcore
# github: https://github.com/pimcore/skeleton

version: '3.8'
services:
pimcore:

services:
init:
image: $W9_REPO:$W9_VERSION
container_name: $W9_NAME
restart: unless-stopped
container_name: $W9_ID-init
restart: on-failure
env_file: .env
ports:
- $W9_HTTP_PORT:80
volumes:
- pimcore:/var/www/html
- ./src/init.sh:/data/init.sh
depends_on:
mariadb:
condition: service_healthy
command: ["bash", "/data/init.sh"]

php:
image: pimcore/pimcore:php8.2-supervisord-latest
container_name: $W9_ID
restart: unless-stopped
logging:
driver: "json-file"
options:
max-file: "5"
max-size: 10m
max-file: "5"
max-size: 10m
env_file: .env
volumes:
- pimcore:/var/www/html
- ./src/supervisord.conf:/etc/supervisor/conf.d/pimcore.conf:ro
environment:
PIMCORE_ENVIRONMENT: dev
MYSQL_HOST: $W9_NAME-db
MYSQL_DATABASE: $W9_DB_MYSQL_NAME
MYSQL_USER: $W9_DB_MYSQL_USER
MYSQL_PASSWORD: $W9_DB_MYSQL_PASSWORD

supervisord:
#user: '1000:1000' # set to your uid:gid
image: pimcore/pimcore:php8.2-supervisord-latest
container_name: $W9_NAME-supervisord
# DATABASE_URL is built from PIMCORE_DB_* variables in .env (Symfony DSN format for PHP runtime)
DATABASE_URL: "mysql://${PIMCORE_DB_USER}:${PIMCORE_DB_PASSWORD}@${PIMCORE_DB_HOST}:3306/${PIMCORE_DB_NAME}"
APP_ENV: prod
depends_on:
db:
condition: service_healthy
volumes:
- .:/var/www/html
- ./src/supervisord.conf:/etc/supervisor/conf.d/pimcore.conf:ro
mariadb:
condition: service_healthy

nginx:
image: nginx:stable-alpine
container_name: $W9_ID-nginx
restart: unless-stopped
ports:
- "$W9_HTTP_PORT:80"
- $W9_HTTP_PORT_SET:$W9_HTTP_PORT
volumes:
- .:/var/www/html:ro
- pimcore:/var/www/html:ro
- ./src/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php

mysql:
image: mysql:$W9_DB_MYSQL_VERSION
container_name: $W9_NAME-db
mariadb:
image: mariadb:$W9_DB_VERSION
container_name: $W9_ID-mariadb
restart: unless-stopped
ports:
- ${W9_DB_MYSQL_PORT}:3306
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --innodb_log_buffer_size=30M
volumes:
- mysql_data:/var/lib/mysql
- mariadb:/var/lib/mysql
environment:
MYSQL_DATABASE: $W9_DB_MYSQL_NAME
MYSQL_USER: $W9_DB_MYSQL_USER
MYSQL_PASSWORD: $W9_DB_MYSQL_PASSWORD
MYSQL_ROOT_PASSWORD: $W9_DB_MYSQL_PASSWORD
MARIADB_DATABASE: $W9_ID
MARIADB_USER: $W9_ID
MARIADB_PASSWORD: $W9_POWER_PASSWORD
MARIADB_ROOT_PASSWORD: $W9_POWER_PASSWORD
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s

redis:
image: redis:alpine
container_name: $W9_NAME-redis
command: [ redis-server, --maxmemory 128mb, --maxmemory-policy volatile-lru, --save "" ]


volumes:
pimcore:
mariadb:

networks:
default:
name: ${W9_NETWORK}
external: true

volumes:
pimcore:
driver: local
mysql_data:
driver: local
name: $W9_NETWORK
external: true
19 changes: 19 additions & 0 deletions apps/pimcore/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# src/ - Pimcore Configuration Files

## nginx.conf
Custom Nginx configuration for serving Pimcore. Handles:
- Static asset serving with cache headers
- PHP-FPM proxy to the `php` service on port 9000
- Pimcore-specific rewrite rules (cache-buster, protected assets)
- Static page cache integration

## supervisord.conf
Supervisord configuration for Pimcore background processes:
- `messenger:consume` – processes async jobs (image optimization, maintenance tasks)
- `maintenance` – runs periodic Pimcore maintenance commands

## init.sh
First-run initialization script executed by the `init` container:
1. Installs the Pimcore skeleton project via Composer
2. Runs `pimcore-install` to initialize the database and admin user
3. Creates a `.installed` lock file to skip re-initialization on subsequent startups
39 changes: 39 additions & 0 deletions apps/pimcore/src/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -e

echo "=== Pimcore Initialization ==="

# Check if Pimcore is already installed
if [ -f /var/www/html/.installed ]; then
echo "Pimcore already initialized, skipping..."
exit 0
fi

cd /var/www/html

# Install Pimcore skeleton if composer.json is missing
if [ ! -f /var/www/html/composer.json ]; then
echo "Creating Pimcore project via composer..."
composer create-project pimcore/skeleton /tmp/pimcore-install --no-interaction
cp -rf /tmp/pimcore-install/. /var/www/html/
rm -rf /tmp/pimcore-install
fi

# Install Pimcore (creates database tables and admin user)
echo "Running pimcore-install..."
php vendor/bin/pimcore-install \
--admin-username="${W9_LOGIN_USER}" \
--admin-password="${W9_LOGIN_PASSWORD}" \
--mysql-host-socket="${PIMCORE_DB_HOST}" \
--mysql-username="${PIMCORE_DB_USER}" \
--mysql-password="${PIMCORE_DB_PASSWORD}" \
--mysql-database="${PIMCORE_DB_NAME}" \
--no-interaction

# Fix file permissions for web server
chown -R www-data:www-data /var/www/html/var /var/www/html/public 2>/dev/null || echo "Warning: Could not set permissions on var/public directories (non-fatal)"

# Mark as installed to skip on subsequent startups
touch /var/www/html/.installed

echo "=== Pimcore Initialization Complete ==="
2 changes: 1 addition & 1 deletion apps/pimcore/variables.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pimcore",
"trademark": "Pimcore ",
"trademark": "Pimcore",
"release": false,
"fork_url": "https://github.com/pimcore/docker",
"version_from": "https://hub.docker.com/r/pimcore/pimcore/tags",
Expand Down