Best practice - app service

The micro update tool designed to work perfectly with device application running as a service. This page includes all the needed information to create a service of your code, and deploy micro updates

How can I deploy updates of my code & run my application?

To be able to deploy updates using the Micro update tool, and run the code at the end of the update, it is recommended to: (1) create a service from the application (2) deploy new code while stopping and starting the application service.

1 - Create a service from your application

  1. Create the file: app.service inside the path /etc/systemd/system/

  2. Add the next lines to the file:

[Unit]
Description=app service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=5
StartLimitBurst=5
User=root
ExecStart=python3 /path/to/the/app/main.py

[Install]
WantedBy=multi-user.target

3. Edit the line "ExecStart" with the path to your code. 4. Save the file. 5. Run the command: systemctl start app 6. Run the command: systemctl enable app

2 - Deploy an update & run application

1. General details - overall information regarding the update. Things like the update version, which devices to deploy the update on, a comment for later reference, etc.

2. Before update - stop the application service: service app stop

3. Upload files/directories - choose files/directories to upload to the devices during the update. Upswift automatically replaces files with the same name: old files will be replaced by new uploaded files.

4. Install dependencies - choose packages to install on the devices. Currently supported package managers: apt, pip, pip3, npm.

5. After update - start the application service: service app start

That's it. Clicking on the Deploy button will begin the deployment on the devices you have selected, and run the service, which will run your new updated application.

Last updated