A Symfony application is a PHP project here: PHP is the console's choice
for "Symfony, or any other PHP application". The console has no Symfony type.
In vallic.yaml, type: symfony and type: php are both accepted and run the
same plain PHP image, served from public/.
Every container gets DATABASE_URL as an environment variable. It is the
single value Doctrine reads, assembled from the same credentials as everything
else.
Keep committing .env; real environment variables win over it. Leave
DATABASE_URL out of it, or put your laptop's value in an uncommitted
.env.local. On the command line, where deploy steps run, a committed value is
not guaranteed to lose.
What you set yourself
APP_ENV. The platform does not set it, and Symfony's own .env says
dev. Left at dev, production runs in debug mode. Pin APP_ENV=prod in
the committed .env, or set it per environment under
Variables if staging should behave differently from production.
The secret. VALLIC_ENTROPY is generated once per environment and never
changes. It can be the secret without anything being committed:
# config/packages/framework.yaml
framework:
secret: '%env(VALLIC_ENTROPY)%'
The manifest
version: 1
type: symfony
runtime:
php: '8.4'
services:
- postgres: '18'
- valkey: '8'
# Only for the asset build below; nothing of it runs beside the site.
- node: '24'
build:
# Composer's and npm's downloads are cached for you. What Composer installs,
# and Webpack Encore's own cache, are not.
cache:
- vendor
- node_modules/.cache
steps:
- composer install --no-dev --optimize-autoloader
# The PHP image has no npm, so the assets build in the Node image.
- name: Assets
image: node
run: npm ci && npm run build
deploy:
steps:
- 'php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration'
- 'php bin/console cache:clear --no-warmup'
- 'php bin/console cache:warmup'
on_failure: rollback
workers:
- name: messenger
command: 'php bin/console messenger:consume async --time-limit=3600'
replicas: 2
services is checked, not obeyed, for the database. The database named
here must be the one the environment was created with, or the deploy refuses. A
database cannot be added or changed from a commit. A service such as Valkey or
Node is started by the next deploy if the environment does not run it yet.
Each name needs a version after it. The environment runs that version from the next deploy. See Service upgrade before you change one that keeps data.
The cache steps only work once the cache has somewhere to go: see Var and cache directories below.
Where migrations run
Run doctrine:migrations:migrate in deploy.steps. It runs on the machine,
after the release is live.
--no-interaction: nothing is there to answer the prompt.--allow-no-migration: without it, a deploy with nothing to migrate exits non-zero and rolls the release back.
Nothing runs here unless you list it. On more than one web server the steps run once, on one of them.
Cron
Nothing is scheduled for you. If you use Symfony Scheduler, run its transport as a worker. Declare anything else:
cron:
- name: cleanup
schedule: '0 3 * * *'
command: 'php bin/console app:cleanup'
Cron runs on one machine only, however many web servers the environment has.
Unlike for Drupal, Laravel and WordPress, restoring a backup clears no cache
for you. Run cache:pool:clear yourself if your pools hold anything the
restore replaced.
Messenger
Run messenger:consume as a worker, with --time-limit set. A consumer
that runs forever slowly leaks memory.
With --time-limit=3600 it exits cleanly every hour and is started again. It
is not a failure and does not appear as one.
Var and cache directories
The release is mounted read-only while the site runs. var/ cannot be
written, by a request or by cache:clear in a deploy step.
The one writable directory a PHP project is given is VALLIC_PRIVATE_DIR
(private/ at the root of the release). It is never served and outlives every
release. Move the cache and the logs there in src/Kernel.php:
public function getCacheDir(): string
{
return $this->writableDir('cache');
}
public function getLogDir(): string
{
return $this->writableDir('log');
}
private function writableDir(string $name): string
{
$base = getenv('VALLIC_PRIVATE_DIR') ?: $this->getProjectDir() . '/private';
$path = sprintf('%s/symfony/%s/%s', $base, $this->environment, $name);
if (!is_dir($path)) {
@mkdir($path, 0775, true);
}
return $path;
}
Logs you want collected belong in VALLIC_LOG_DIR instead. Point Monolog's
file handler at %env(VALLIC_LOG_DIR)%/symfony.log and its lines reach the
console's logs: see Logs.
Uploads have no directory of their own on a PHP project: there is no
VALLIC_PUBLIC_DIR. Declare the directory you serve them from as a mount. It
is kept outside the release and linked back into every one:
mounts:
- public/uploads
Sessions
Symfony's default keeps sessions in files on the machine that answered the
request. With more than one web server, a visitor is logged out whenever the
next request lands on another machine. Keep them in Valkey, which answers on
REDIS_HOST and REDIS_PORT:
# config/packages/framework.yaml
framework:
session:
handler_id: 'redis://%env(REDIS_HOST)%:%env(REDIS_PORT)%'
Next
Thank you. Good to know it helped.
Thanks — tell us what was missing. Open a ticket from Support in the console, and we answer on the ticket. Open the console