Best way to have Datalore Enterprise auto-start?

I just upgraded Datalore Enterprise to 2023.1, and am using docker compose on Ubuntu server. What’s the best way to have this automatically launch at start since it requires ‘docker compose up’? I’m open to installing more software. Datalore is the only thing this server is doing at the moment.

Thanks!

You could use systemd for starting anything in docker. Create file /etc/systemd/system/datalore.service with the content like that:

[Unit]
Description=Service for Datalore
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
WorkingDirectory=/your/directory/with/compose-file
ExecStart=/usr/bin/env /usr/bin/docker compose -f /your/directory/with/compose-file/docker-compose.yaml up -d
ExecStop=/usr/bin/env /usr/bin/docker compose -f /your/directory/with/compose-file/docker-compose.yaml stop
StandardOutput=syslog
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Don’t forget to replace /your/directory/with/compose-file with the appropriate dir. Also, ensure that compose plugin is installed for all users.
After that reload services with systemctl daemon-reload command.
Execute systemctl enable datalore to enable automatic launch at system boot.
You also will be able to start/stop datalore via commands systemctl start datalore and systemctl stop datalore manually.

1 Like