Skip to content

Deploy an application as a service on your machines

What you'll learn:

  • How the Déploiement d'applicatifs page works, and what a machine needs before the first deployment
  • How to describe the systemd service once, and reuse it at every deployment
  • What the simulation, the confirmation and the deployment each do on the machine
  • Where the previous versions go, and how to go back

Time: ~15 minutes
Prerequisites: A maintainer or administrator account, an artifact already in a Repod repository (see Manage your Maven, PyPI and npm repositories), and a machine reachable over SSH with systemd and the runtime your application needs (for example Java).


What this page is for

An application built as a Maven, PyPI or npm artifact lives in a Repod repository. This page puts it in service on your machines, over SSH: it downloads the file, installs it in a versioned folder and runs it as a systemd service. It follows the same flow as the container deployment (see Deploy a container image on your machines): a simulation, then your confirmation, then the real deployment.

An artifact is only a file, with no standard way to "run it". So you describe once how to start it, and Repod reuses that description at every deployment.

Two rules protect you:

The commands run without sudo

Repod runs the deployment commands with the SSH account of the machine, without sudo. That account must be able to write in /etc/systemd/system and run systemctl: in practice, root or an account with equivalent rights. Check it on a test machine first.


Step 1 — Choose the artifact

Open Applicatifs → Déploiement.

The page: the format tabs, the repository, artifact and version choices, and the form describing the systemd service

Figure 1 — The format (1), the repository (2), the artifact (3), the version (4), the service settings (5), the start command (6) and the Save button (7).

  1. Choose the format (1): Maven, PyPI or npm.
  2. Choose the repository (2), the artifact (3) and the version (4). Only what exists is offered. For Maven, Repod picks the runnable file (.jar or .war), never the .pom or the sources.

Step 2 — Describe the service

The block (5) is saved once per artifact and reused. Fill it in and click Enregistrer (7). Without it, Repod refuses to create the deployment.

Field What to enter
Nom du service The systemd unit name, for example myapp.service
Dossier d'installation Where the application lives on the machine, for example /opt/myapp
Commande de démarrage The command that starts it. It must contain {artifact}, which Repod replaces with the path of the downloaded file (6), for example /usr/bin/java -jar {artifact}
Utilisateur / Groupe The account the service runs as. Default root
Variables d'environnement One per line, KEY=value, for example JAVA_OPTS=-Xmx512m
Politique de redémarrage on-failure (default), always, no, on-abnormal…
Lignes [Service] additionnelles Extra lines for the [Service] section, for example LimitNOFILE=65536

Three points to know:

  • Use a dedicated user instead of root for a real application. Repod does not create that user nor change the ownership of the files: it must exist on the machine and be able to read the installation folder.
  • Repod writes the unit for you. Do not create the file by hand: it is overwritten at each deployment.
  • A jar fits directly; a wheel or a tarball does not. The start command is yours, and the runtime must already be on the machine. A Python wheel or an npm tarball needs a command that knows how to use that file.

Do not put secrets in the environment variables

The values are stored in clear with the settings and written into the unit file on the machine. Pass secrets another way.


Step 3 — Choose the machines and start

Scroll down.

The target machines list, the Deploy button with the artifact and its version, and the empty list of deployment jobs

Figure 2 — The target machines (1), the checkboxes (2), the Deploy button (3) and the jobs (4).

Tick the machines (2), then click Déployer followed by the artifact and its version (3). A job appears under Jobs de déploiement (4).

Before creating the job, Repod checks that the artifact is cleared, that the settings are saved, that every chosen machine exists and is not in agent mode, and that their maintenance windows overlap at some point (see Restrict deployments to maintenance windows). If a window exists but is not open yet, the job waits for it.


Step 4 — Read the simulation and confirm

The job goes through the same steps as a container deployment: waiting for a window, Simulation (téléchargement + vérification systemd), Attente de confirmation, Déploiement en cours, Terminé. Up to two jobs run at once by default.

The simulation does the following on each machine:

  • It checks that systemd is present and that the installation folder can be created. This is the only thing it may create: an empty releases folder.
  • It downloads the artifact into a temporary file, with a temporary token that can only download.
  • It checks the syntax of the unit with systemd-analyze on a temporary file. The real unit is not written yet.
  • It compares the version currently installed with the target. If it is the same, the machine is marked à jour.
  • It deletes its temporary files.

When the job reaches Attente de confirmation, open a machine and Afficher la sortie brute to read the result. Click Confirmer to go on, or Annuler: the real service has not been touched.


Step 5 — What the deployment does

On each machine, after you confirm, Repod:

  1. downloads the artifact into {install folder}/releases/{version}/;
  2. points the current link to that version;
  3. writes the unit in /etc/systemd/system/ and runs daemon-reload, enable and restart;
  4. checks that the service is active and that current points to the expected version.

The unit always starts the file through current, never through a fixed version path. Every version stays in releases/: nothing is deleted.

Going back to the previous version

There is no automatic rollback, but going back is simple, because the old version is still on the machine. Deploy the previous version again from this page. It restarts the service on that version.

The link current is changed before the restart: if the service fails to start, the machine is shown in error, and current already points to the new version. Fix the cause or deploy the previous version.


What this page does not do

  • It does not install the runtime (Java, Python, Node) or create the service user.
  • It does not roll back by itself (see above), and it does not clean the old versions.
  • It does not check your application's health, only that the service is active.
  • It cannot reach machines in agent mode.

What's next