Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
9 changes: 9 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: "en-US"
reviews:
profile: "chill"
high_level_summary: true
auto_review:
enabled: true
base_branches:
- ".*"
drafts: false
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Docker build context exclusions
.git
.gitignore
.github
.idea
.vscode
node_modules
npm-debug.log
yarn.lock
composer.phar
var/cache
var/logs
var/sessions
.env
Dockerfile*
docker-compose*.yml
**/.DS_Store
**/Thumbs.db
vendor/
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Exclude tests and development stuff from archives
/tests export-ignore
/.github export-ignore
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ on: [push, pull_request]
jobs:
main:
name: phpList Base Dist on PHP ${{ matrix.php-versions }}, with dist ${{ matrix.dependencies }} [Build, Test]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
DB_DATABASE: phplist
DB_USERNAME: root
DB_PASSWORD: phplist
BROADCAST_DRIVER: log
BROADCAST_DRIVER: log
services:
mysql:
image: mysql:5.7
Expand Down Expand Up @@ -63,7 +63,13 @@ jobs:
- name: Run integration tests with phpunit
run: vendor/bin/phpunit tests/Integration/
- name: Running the system tests
run: vendor/bin/phpunit tests/System/;
run: |
export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }}
export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }}
export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }}
export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }}
export PHPLIST_DATABASE_HOST=127.0.0.1
vendor/bin/phpunit tests/System/
- name: Running static analysis
run: vendor/bin/phpstan analyse -l 5 src/ tests/;
- name: Running PHPMD
Expand Down
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# syntax=docker/dockerfile:1

# Build a production image for phpList base-distribution (Symfony-based)
FROM php:8.1-apache-bullseye

# Set workdir
WORKDIR /var/www/html

# Install system dependencies and PHP extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git unzip libzip-dev libicu-dev libpng-dev libonig-dev libxml2-dev \
libc-client2007e-dev libkrb5-dev libssl-dev libpq-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install -j"$(nproc)" \
pdo pdo_mysql pdo_pgsql zip intl imap \
&& rm -rf /var/lib/apt/lists/*

# Enable Apache modules and set DocumentRoot to /public
RUN a2enmod rewrite headers \
&& sed -ri 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf \
&& sed -ri 's!/var/www/!/var/www/html/public!g' /etc/apache2/apache2.conf \
&& echo "<Directory /var/www/html/public>\n AllowOverride All\n Require all granted\n</Directory>" > /etc/apache2/conf-available/phplist.conf \
&& a2enconf phplist

# Copy composer definition first and install dependencies
COPY composer.json composer.lock ./

# Install Composer
ENV COMPOSER_ALLOW_SUPERUSER=1 \
PATH="/usr/local/bin:${PATH}"
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& rm composer-setup.php

# Ensure config directory exists for Composer scripts that write into it
COPY config ./config

# Install PHP dependencies (include scripts so phpList creates config structure)
RUN composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader

# Copy the rest of the application (except files ignored by .dockerignore)
COPY . .

# Build Symfony prod cache to match the current vendor code (prevents stale container issues)
# If env vars are needed for DB during warmup, they can be provided at runtime; warmup should still succeed without DB.
RUN php bin/console cache:clear --env=prod --no-warmup || true \
&& php bin/console cache:warmup --env=prod || true

# Ensure correct permissions for cache/logs
RUN chown -R www-data:www-data var public \
&& find var -type d -exec chmod 775 {} \; \
&& find var -type f -exec chmod 664 {} \;

# Expose port and run Apache
EXPOSE 80
CMD ["apache2-foreground"]
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,36 @@ contribute and how to run the unit tests and style checks locally.
This project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
By participating in this project and its community, you are expected to uphold
this code.


## Docker deployment

The project includes a Docker setup to run phpList with Apache and MySQL.

Quick start (development/test):

- Build and start the stack: `docker compose up --build`
- Open http://localhost:8080

The app container is configured to read database settings from environment variables that match config/parameters.yml defaults. The provided docker-compose.yml sets:

- PHPLIST_DATABASE_HOST=db
- PHPLIST_DATABASE_PORT=3306
- PHPLIST_DATABASE_NAME=phplistdb
- PHPLIST_DATABASE_USER=phplist
- PHPLIST_DATABASE_PASSWORD=phplist

Notes:

- For production deployments, build and push the image, then run it behind a reverse proxy or load balancer. Example:
- `docker build -t your-registry/phplist-base:latest .`
- `docker run -p 8080:80 --env PHPLIST_DATABASE_HOST=... --env PHPLIST_DATABASE_NAME=... --env PHPLIST_DATABASE_USER=... --env PHPLIST_DATABASE_PASSWORD=... your-registry/phplist-base:latest`
- Persist the MySQL data using the db_data volume defined in docker-compose.yml, or bind mount your own volume.
- You can also mount ./var to persist logs/cache between restarts. See commented volume in docker-compose.yml.
- The container uses Apache with DocumentRoot set to /var/www/html/public and mod_rewrite enabled.
- The base image uses PHP 8.1 (php:8.1-apache-bullseye) to match the Composer constraint (^8.1) and to ensure the IMAP build dependencies are available. You can bump to a newer 8.x tag (e.g., 8.3) if your deployment prefers it, but ensure IMAP build deps are present for that base.


```bash
docker exec -it base-distribution-app bash
```
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@
{
"type": "vcs",
"url": "https://github.com/tatevikgr/phplist-api-client"
},
{
"type": "vcs",
"url": "https://github.com/tatevikgr/rss-bundle.git"
}
],
"require": {
"php": "^8.1",
"phplist/core": "dev-main",
"phplist/rest-api": "dev-main",
"phplist/web-frontend": "dev-master",
"phplist/web-frontend": "dev-main",
"doctrine/orm": "^3.3",
"tatevikgr/rest-api-client": "dev-ISSUE-357"
"tatevikgr/rest-api-client": "dev-ISSUE-357",
"tatevikgr/rss-feed": "dev-main as 0.1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.2",
Expand Down Expand Up @@ -103,5 +108,10 @@
"symfony-var-dir": "var",
"symfony-web-dir": "public",
"symfony-tests-dir": "tests"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
Loading
Loading