summaryrefslogtreecommitdiff
path: root/content/install/upgrading-from-v1-to-v2.md
blob: 41f39f5eedb4447fc2d51ba255d623538066b520 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
title: "Upgrading YAMS from version 1 to version 2 (Advanced)"
date: 2023-10-25T19:19:19-03:00
draft: false
weight: 4
summary: Are you running YAMS v1? Here's the guide to upgrade YAMS to v2!
---

# First, a brief disclaimer

I want to make this very clear: **This is entirely optional!** I will continue to support YAMS v1 as well as YAMS v2.

If you are completely happy with YAMS v1, or have a heavily modified setup, you can skip this tutorial!

## What are the advantages?

- YAMS v2 introduces a new command: `yams upgrade`. It allows YAMS to upgrade itself.
- Adding custom containers is now easier. You can find the tutorial here: [Add your own containers](/advanced/add-your-own-containers/).

# Before starting
# ⚠ BACKUP YOUR CONFIGURATION! ⚠

Some of these operations **MIGHT BE DESTRUCTIVE!** Ensure you have everything backed up before making any changes.

# Let's begin!

First, clone the YAMS repository in any directory (**do NOT** use your installation directory!). For the purposes of this tutorial, I'll use `~/yams_upgrade`.


```bash
git clone --depth 1 https://gitlab.com/rogs/yams.git ~/yams_upgrade
cd ~/yams_upgrade
```

## Setup .env.example

Begin by opening the `.env.example` file. Add your correct information to the file. All this information is currently available in your YAMS v1 `docker-compose.yaml` file.

For the purposes of this tutorial:

- My `PUID` and `PGID` are both set to `1000`.
- All the other settings are going to be the defaults set in the installer.
- Your media server name must be in lowercase. Accepted values are: `jellyfin`, `emby`, and `plex`.
- The VPN is set to be enabled (`y`) and configured to use Mullvad. If you are not using a VPN, leave the VPN configuration empty.

Here's how it should look:


```bash
# Base configuration
PUID=1000
PGID=1000
MEDIA_DIRECTORY=/srv/media
INSTALL_LOCATION=/opt/yams
MEDIA_SERVICE=jellyfin

# VPN configuration
VPN_ENABLED=y
VPN_SERVICE=mullvad
VPN_USER=12345678901234567890
VPN_PASSWORD=12345678901234567890
```

## Setup the YAMS binary

Now it's time to set up the `yams` binary. You need to replace some variables in this command, so proceed with caution:

- For the first line, the format is `/your/install/location/docker-compose.yaml`. In this tutorial, the value should be `/opt/yams/docker-compose.yaml`.
- For the second line, the format is `/your/install/location/docker-compose.custom.yaml`. In this tutorial, the value should be `/opt/yams/docker-compose.custom.yaml`.
- For the third line, the format is `/your/install/location`. In this tutorial, the value should be `/opt/yams`.

Run each of the `sed` commands separately!

```bash
sed -i -e "s|<filename>|/opt/yams/docker-compose.yaml|g" yams
                      # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ REPLACE THE FIRST LINE HERE BETWEEN THE "|"
sed -i -e "s|<custom_file_filename>|/opt/yams/docker-compose.custom.yaml|g" yams
                                  # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ REPLACE THE SECOND LINE HERE BETWEEN THE "|"
sed -i -e "s|<install_location>|/opt/yams|g" yams
                               # ^^^^^^^^^ REPLACE THE THIRD LINE HERE BETWEEN THE "|"
```

## If you have custom containers:

Move your custom containers to `docker-compose.custom.yaml`. If you need help, you can use this tutorial from the "Adding a container" section: [Add your own containers - Adding a container](/advanced/add-your-own-containers/#adding-a-container).

# Finish the upgrade

First, you need to stop YAMS. Run:

```bash
yams stop
```

## Copy the files to the correct locations

Now that you have all the changes ready for your setup, you can copy the files to the correct location.

### Copying .env.example file

You need to copy the `.env.example` file to the correct location. For the purposes of this tutorial, I will copy it to `/opt/yams/` and rename it to `.env`:

```bash
cp .env.example /opt/yams/.env
```

### Copying the docker-compose.custom.yaml file

Now, copy the file to the install location. For the purposes of this tutorial, I will copy it to `/opt/yams/`:

```bash
cp docker-compose.custom.yaml /opt/yams/
```

Let's also backup your current `docker-compose.yaml` configuration for safekeeping:

```bash
cp /your/install/location/docker-compose.yaml docker-compose.yaml.backup
```

### Copying the `yams` binary to the right place

This command will copy the current `yams` binary for backup and copy the new `yams` binary to the right place:

```bash
cp $(which yams) yams-old
sudo cp yams $(which yams)
```

### Run the upgrade!

Now it's the time to execute the update!

```bash
yams update
```

Everything should be up and running!

# That's done!

YAMS should start back up again, and everything should be working as expected with the difference that now YAMS can be upgraded by using `yams upgrade`.

If you have any issues upgrading from v1 to v2, you can create a new post in our forum: [YAMS Forum: Upgrading YAMS from v1 to v2](https://forum.yams.media/viewforum.php?f=26)