---
title: Updating and autostart
description: Updating the IIoT Platform to new image versions and configuring it to start automatically when the server boots.
section: Deployment
weight: 2
related:
  - installation
  - operations/backup-and-restore
  - security/security-mechanisms
---

import Steps from '@/components/docs/Steps.astro';

After the platform is installed and running, use the steps below to update it to new image versions and to make it start automatically when the server boots.

<Steps>

### Update the software

To update the software, stop the containers in `/opt/vadtelnewweb`:

```bash
docker-compose down
```

Then go to `/var/lib/unicloud` and do the following.

- Stop the `unicloud` service:

```bash
sudo service unicloud stop
```

- Shut down the containers:

```bash
docker-compose down
```

Copy and unpack the new compressed image files:

```bash
gunzip vadtel-nginx-latest.tar.gz
gunzip vadtel-app-latest.tar.gz
gunzip anytelemetry-latest.tar.gz
gunzip pgbouncer-latest.tar.gz
gunzip vadteljsondaemon-latest.tar.gz
gunzip logrotate-latest.tar.gz
gunzip postgres-15.1-alpine.tar.gz
gunzip redis-6.0.16-alpine.tar.gz
gunzip vector-latest.tar.gz
```

Load the images into Docker:

```bash
docker load -i vadtel-nginx-latest.tar
docker load -i vadtel-app-latest.tar
docker load -i anytelemetry-latest.tar
docker load -i pgbouncer-latest.tar
docker load -i vadteljsondaemon-latest.tar
docker load -i logrotate-latest.tar
docker load -i postgres-15.1-alpine.tar
docker load -i redis-6.0.16-alpine.tar
docker load -i vector-latest.tar.gz
```

Check that the images are available:

```bash
docker images
```

If the images loaded without errors, run the following commands from the `/var/lib/unicloud` folder:

```shell
sudo service unicloud start
docker-compose up -d
```

Then go to `/opt/vadtelnewweb` and start the application:

```shell
docker-compose up -d
```

Check the running containers:

```bash
docker ps
```

### Configure autostart

Create, edit, or copy the `/etc/docker/daemon.json` configuration file and add the following
(adjust the values if necessary):

```json title="daemon.json"
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "50m",
    "max-file": "3"
  }
}
```

Next, create an autostart script for the application. You need a `docker-compose-vadtel.service`
file with the contents below, where `WorkingDirectory` is the path to `docker-compose.yml`.

Open the file:

```shell
nano /etc/systemd/system/docker-compose-vadtel.service
```

Add the following contents:

```ini title="docker-compose-vadtel.service"
[Unit]
Description=Docker Compose vadtel Application Service
Requires=docker.service
After=docker.service
StartLimitIntervalSec=60

[Service]
WorkingDirectory=/opt/vadtelnewweb
ExecStart=/usr/bin/docker-compose up
ExecStop=/usr/bin/docker-compose down
TimeoutStartSec=0
Restart=on-failure
StartLimitBurst=3

[Install]
WantedBy=multi-user.target
```

To enable the autostart script from `/etc/systemd/system/`, run:

```shell
sudo systemctl enable docker-compose-vadtel
```

</Steps>
