Hi, we are using Symfony app and it is deployed to the App Platform. One of the components that we are using is the Symfony Messenger. This component acts like a async worker on the background where it runs long running queries. One of the options to keep the worker running on the background is to use the systemd. Messenger: Sync & Queued Message Handling (Symfony Docs)
“Systemd user service configuration files typically live in a ~/.config/systemd/user
directory. For example, you can create a new messenger-worker.service
file. Or a messenger-worker@.service
file if you want more instances running at the same time:”
[Unit]
Description=Symfony messenger-consume %i
[Service]
ExecStart=php /path/to/your/app/bin/console messenger:consume async --time-limit=3600
Restart=always
RestartSec=30
[Install]
WantedBy=default.target
I tried this using the App Platform console but unfortunately, I don’t have permission to do so and if I remember correctly, the next deployment resets everything back to default.
My question is, how can we create a systemd on the Digital App Platform?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi there,
Indeed, creating custom systemd services would require root access to the underlying infrastructure which you get only with Droplets.
With the App Platform, you could just use a worker instead:
Background workers can consist of any application code you like. As far as App Platform is concerned, they are the same as services, except they are not routable, meaning they are not accessible via an external URL.
You can add an additional worker component to your existing app and just run the console command:
That way the App Platform and the worker will be responsible for running that process which is basically the alternative of running this as a systemd service on a standalone server.
Hope that this helps!
Best,
Bobby