I am trying to run/(auto-start) "meltano ui, airfl...
# plugins-general
n
I am trying to run/(auto-start) "meltano ui, airflow schedular, and airflow webserver" using systemd. Does anyone have any pointers? Also the end goal is to run those things automatically (in case of server vm restart or anything like that), so if there is any other mechanism that would work, i am open to suggestion. Thanks
d
@nil Have you considered using Docker Compose: https://meltano.com/docs/containerization.html#docker-compose, and ha using systemd to make sure
docker-compose up -d
keeps running as a service?
Otherwise you'd add individual services for
meltano ui
,
airflow scheduler
and
airflow webserver
n
@douwe_maan thanks for prompt reply, I am not planning to use docker for our current setup (as far as I can see we will want to run things in k8 eventually). Do you have a sample for meltano ui as a daemon/service?
@douwe_maan thanks for prompt reply, I am not planning to use docker for our current setup (as far as I can see we will want to run things in k8 eventually). Do you have a sample for meltano ui as a daemon/service?
d
@nil When we were offering hosting Meltano instances for a bit earlier this year, we used https://gitlab.com/meltano/infrastructure/-/blob/master/playbooks/templates/systemd/meltano.service, but it has some templating going on which makes it harder to read: https://gitlab.com/meltano/infrastructure/-/blob/master/playbooks/meltano.yml#L5-7
Most important for you are going to be setting the
WorkingDirectory
to the Meltano project dir, setting
Environment=PATH
so that
meltano
is reachable, and then setting
ExecStart
to point at
meltano ui
And then repeating the trick for airflow scheduler and webserver
n
I think i am not authorised to the links you posted (i am getting 404) I am trying to figure out the things that you mentioned about working dir and things (hence, i was asking for ui sample, so i can use that as a base for scheduler and webserver 🙂)
d
Ah right, it's still a private repo 😅 Here's
meltano.service
:
Copy code
[Unit]
Description=Meltano UI
After=network.target

[Service]
Type=simple
User=meltano
WorkingDirectory={{ project_dir }}
Environment=FLASK_ENV=production
Environment=PATH={{ home_dir }}/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
EnvironmentFile=-{{ env_dir }}/*
ExecStartPre={{ home_dir }}/.venv/bin/meltano upgrade
ExecStart={{ home_dir }}/.venv/bin/meltano ui
ExecReload={{ scripts_dir }}/meltano_reload.sh
#ExecStop=/bin/kill -s TERM $MAINPID
#ExecStopPost=/bin/rm -rf {{ project_dir }}/.meltano/run
Restart=always

[Install]
WantedBy=multi-user.target
{{ project_dir }}
etc is part of ansible templating
In your case you'd have real, full paths there
n
that is awesome 👍