Operations
An installation runs a web server with PHP, a database, a Messenger worker and a Mercure hub.
Database migrations
After installing a package or updating, run the migrations. The command is safe to repeat:
bin/console doctrine:migrations:migrate --no-interaction
Cache
After installing a package or updating, rebuild the cache in two steps. Without the second, the first requests take several seconds each:
bin/console cache:clear --no-warmup
bin/console cache:warmup
Messenger worker
The worker processes background and recurring jobs:
bin/console messenger:consume scheduler_default async_high async_low
scheduler_: recurring jobs such as reminders, daily digests, purges, automatic clock-out and closing attendance daysdefault async_: the consequences of every change, such as recalculations, notifications and live updateshigh async_: bulk work such as exports, report subscriptions and large recalculationslow
Without a running worker, changes are saved but their consequences wait in the queues. A missed recurring run is made up once when the worker is back.
Messages that still fail after five retries move to the transport failed:
bin/console messenger:failed:show
bin/console messenger:failed:retry
bin/console messenger:failed:remove <id>
Start the worker with the application, restart it when it stops, and on every deploy run
bin/. An example for systemd:
[Unit]
Description=adsum Messenger worker
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/adsum
ExecStart=/usr/bin/php bin/console messenger:consume scheduler_default async_high async_low --time-limit=3600
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Mercure hub
Both keys of the hub equal MERCURE_:
docker run -d --name mercure \
-e SERVER_NAME=':80' \
-e MERCURE_PUBLISHER_JWT_KEY='the-value-of-MERCURE_JWT_SECRET' \
-e MERCURE_SUBSCRIBER_JWT_KEY='the-value-of-MERCURE_JWT_SECRET' \
-e MERCURE_EXTRA_DIRECTIVES=$'anonymous 0\ncors_origins https://adsum.company.com' \
dunglas/mercure:v0.19
The reverse proxy forwards /. to the hub without buffering:
location /.well-known/mercure {
proxy_pass http://mercure;
proxy_http_version 1.1;
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 24h;
proxy_set_header Connection '';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
In .env.:
MERCURE_URL=http://mercure/.well-known/mercure
MERCURE_PUBLIC_URL=https://adsum.company.com/.well-known/mercure
MERCURE_JWT_SECRET=<the secret>
Mail delivery
Set MAILER_ (see Configuration). smtp:// and sendmail:// work out of the box; for
a provider such as Amazon SES or Mailgun, install its Symfony Mailer bridge with Composer.
File storage
Uploaded and generated files lie in the file storage (see ADSUM_FILE_BACKEND). Files that the application kept before it, such as leave attachments, photos, logos and exports, are moved into it once after the update:
bin/console adsum:files:adopt-legacy --dry-run # list the files that would move
bin/console adsum:files:adopt-legacy
The command checks every copy by its checksum and leaves the old files where they are, so it is safe to repeat; files
that are gone or changed on the way are listed and stay where they were. Remove the old directories once the list is
empty. To move the storage from the server's directory into a bucket, copy var/ into the bucket
with the same paths and switch ADSUM_FILE_BACKEND.
Change history protection
Optionally, protect the change history (table audit_) in the database: revoke UPDATE and DELETE from
the application's database user and give a second user DELETE for the retention purge. The purge job then runs
with the DATABASE_ of that second user.
PostgreSQL:
REVOKE UPDATE, DELETE ON audit_entry FROM adsum_app;
GRANT SELECT, DELETE ON audit_entry TO adsum_purge;
MariaDB, with table-level grants instead of a database-wide UPDATE and DELETE:
GRANT SELECT, INSERT ON adsum.audit_entry TO 'adsum_app'@'%';
GRANT SELECT, DELETE ON adsum.audit_entry TO 'adsum_purge'@'%';
Run the migrations with a user that may still change the table.
Backups
Back up the database, the file storage (var/ or the bucket) and the directories
app. and app. (see Composer).
The login company
The login and password pages show the branding of one company. With one company, that is the one; with several, choose it. Without a choice, the pages show the adsum mark:
bin/console app:branding:login-company # show the login company
bin/console app:branding:login-company --company=<company ID>
bin/console app:branding:login-company --clear
Logs
Check var/ after a deploy and when users report errors (see Configuration).
Monitoring
- Web server and PHP: response times, error rate
- Database: connections, disk usage
- Worker: that it runs, and the transport
failed - Mercure hub: that
/.answerswell- known/ mercure - Mail server: delivery failures
Importing punches
To take over the punches of a previous system:
bin/console app:attendance:import-punches punches.csv
The CSV file has the columns employee, type (clock, clock, break, break) and
instant (ISO 8601 with offset), in chronological order. A line that does not fit the punches before it is
reported and skipped. Imported punches skip the checks of live punches and notify nobody.
Muting violation notices of one employee
Stop the notices about working-time violations of one employee:
bin/console adsum:attendance:mute-violation-notices <employee ID> on
bin/console adsum:attendance:mute-violation-notices <employee ID> off
The violations are still recorded and shown; the change history records every switch.
Importing the starter FAQ
Take the starter entries of the help-desk FAQ into a company, in English and German; HR and administrators can do the same on the FAQ page:
bin/console adsum:helpdesk:import-starter-faqs <company ID>
bin/console adsum:helpdesk:import-starter-faqs <company ID> --entry=requestLeave --entry=raiseTicket
Entries whose English question the company has already are skipped, so the command can run again.