]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - doc/md/Upgrade-and-migration.md
doc: updagrde/migration: simplify permissions setup
[github/shaarli/Shaarli.git] / doc / md / Upgrade-and-migration.md
CommitLineData
91a21c27 1# Upgrade and migration
53ed6d7d 2
91a21c27 3## Note your current version
b230bf20 4
48679a15 5If anything goes wrong, it's important for us to know which version you're upgrading from.
6c4cc14e 6The current version is present in the `shaarli_version.php` file.
b230bf20 7
fdf88d19 8
91a21c27 9## Backup your data
43ad7c8e 10
91a21c27 11Shaarli stores all user data and [configuration](Shaarli-configuration.md) under the `data` directory. [Backup](Backup-and-restore.md) this repository _before_ upgrading Shaarli. You will need to restore it after the following upgrade steps.
fdf88d19 12
91a21c27 13```bash
14sudo cp -r /var/www/shaarli.mydomain.org/data ~/shaarli-data-backup
15```
fdf88d19 16
91a21c27 17## Upgrading from ZIP archives
53ed6d7d 18
91a21c27 19If you installed Shaarli from a [release ZIP archive](Installation.md#from-release-zip):
fdf88d19 20
91a21c27 21```bash
22# Download the archive to the server, and extract it
23cd ~
24wget https://github.com/shaarli/Shaarli/releases/download/v0.X.Y/shaarli-v0.X.Y-full.zip
25unzip shaarli-v0.X.Y-full.zip
26
27# overwrite your Shaarli installation with the new release **All data will be lost, see _Backup your data_ above.**
28sudo rsync -avP --delete Shaarli/ /var/www/shaarli.mydomain.org/
29
30# restore file permissions as described on the installation page
31sudo chown -R root:www-data /var/www/shaarli.mydomain.org
1a19c921 32sudo chmod -R g+rX /var/www/shaarli.mydomain.org
91a21c27 33sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/}
34
35# restore backups of the data directory
36sudo cp -r ~/shaarli-data-backup/* /var/www/shaarli.mydomain.org/data/
37
38# If you use gettext mode for translations (not the default), reload your web server.
39sudo systemctl restart apache2
40sudo systemctl restart nginx
41```
fdf88d19 42
91a21c27 43If you don't have shell access (eg. on shared hosting), backup the shaarli data directory, download the ZIP archive locally, extract it, upload it to the server using file transfer, and restore the data directory backup.
1a47014f 44
91a21c27 45Access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [Shaarli configuration](Shaarli-configuration.md) for more details).
fdf88d19 46
53ed6d7d 47
91a21c27 48## Upgrading from Git
53ed6d7d 49
91a21c27 50If you have installed Shaarli [from sources](Installation.md#from-sources):
fdf88d19
A
51
52```bash
91a21c27 53# pull new changes from your local clone
54cd /var/www/shaarli.mydomain.org/
55sudo git pull
fdf88d19 56
91a21c27 57# update PHP dependencies (Shaarli >= v0.8)
58sudo composer install --no-dev
fdf88d19 59
91a21c27 60# update translations (Shaarli >= v0.9.2)
61sudo make translate
fdf88d19 62
91a21c27 63# If you use translations in gettext mode (not the default), reload your web server.
64sudo systemctl reload apache
65sudo systemctl reload nginx
fdf88d19 66
91a21c27 67# update front-end dependencies (Shaarli >= v0.10.0)
68sudo make build_frontend
1a47014f 69
91a21c27 70# restore file permissions as described on the installation page
71sudo chown -R root:www-data /var/www/shaarli.mydomain.org
1a19c921 72sudo chmod -R g+rX /var/www/shaarli.mydomain.org
91a21c27 73sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/}
74```
1a47014f 75
91a21c27 76Access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [Shaarli configuration](Shaarli-configuration.md) for more details).
1a47014f 77
91a21c27 78---------------------------------------------------------------
d7eb06bd 79
91a21c27 80## Migrating and upgrading from Sebsauvage's repository
53ed6d7d 81
82If you have installed Shaarli from [Sebsauvage's original Git repository](https://github.com/sebsauvage/Shaarli), you can use [Git remotes](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) to update your working copy.
fdf88d19
A
83
84The following guide assumes that:
43ad7c8e 85
53ed6d7d 86- you have a basic knowledge of Git [branching](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) and [remote repositories](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)
fdf88d19
A
87- the default remote is named `origin` and points to Sebsauvage's repository
88- the current branch is `master`
53ed6d7d 89 - if you have personal branches containing customizations, you will need to [rebase them](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) after the upgrade; beware though, a lot of changes have been made since the community fork has been created, so things are very likely to break!
fdf88d19
A
90- the working copy is clean:
91 - no versioned file has been locally modified
92 - no untracked files are present
93
91a21c27 94### Step 0: show repository information
53ed6d7d 95
fdf88d19
A
96```bash
97$ cd /path/to/shaarli
98
99$ git remote -v
100origin https://github.com/sebsauvage/Shaarli (fetch)
101origin https://github.com/sebsauvage/Shaarli (push)
102
103$ git branch -vv
53ed6d7d 104* master 029f75f [origin/master] Update README.md
fdf88d19
A
105
106$ git status
107On branch master
108Your branch is up-to-date with 'origin/master'.
109nothing to commit, working directory clean
110```
111
91a21c27 112### Step 1: update Git remotes
53ed6d7d 113
fdf88d19
A
114```
115$ git remote rename origin sebsauvage
116$ git remote -v
117sebsauvage https://github.com/sebsauvage/Shaarli (fetch)
118sebsauvage https://github.com/sebsauvage/Shaarli (push)
119
120$ git remote add origin https://github.com/shaarli/Shaarli
121$ git fetch origin
122
123remote: Counting objects: 3015, done.
124remote: Compressing objects: 100% (19/19), done.
125remote: Total 3015 (delta 446), reused 457 (delta 446), pack-reused 2550
126Receiving objects: 100% (3015/3015), 2.59 MiB | 918.00 KiB/s, done.
127Resolving deltas: 100% (1899/1899), completed with 48 local objects.
128From https://github.com/shaarli/Shaarli
53ed6d7d 129 * [new branch] master -> origin/master
130 * [new branch] stable -> origin/stable
131[...]
132 * [new tag] v0.6.4 -> v0.6.4
133 * [new tag] v0.7.0 -> v0.7.0
fdf88d19
A
134```
135
91a21c27 136### Step 2: use the stable community branch
fdf88d19
A
137
138```bash
139$ git checkout origin/stable -b stable
140Branch stable set up to track remote branch stable from origin.
141Switched to a new branch 'stable'
142
143$ git branch -vv
53ed6d7d 144 master 029f75f [sebsauvage/master] Update README.md
145* stable 890afc3 [origin/stable] Merge pull request #509 from ArthurHoaro/v0.6.5
fdf88d19
A
146```
147
53ed6d7d 148Shaarli >= `v0.8.x`: install/update third-party PHP dependencies using [Composer](https://getcomposer.org/):
fdf88d19
A
149
150```bash
b230bf20 151$ composer install --no-dev
fdf88d19
A
152
153Loading composer repositories with package information
154Updating dependencies
155 - Installing shaarli/netscape-bookmark-parser (v1.0.1)
156 Downloading: 100%
157```
158
1a47014f
A
159Shaarli >= `v0.9.2` supports translations:
160
161```bash
162$ make translate
163```
164
165If you use translations in gettext mode, reload your web server.
166
91a21c27 167Shaarli >= `v0.10.0` manages its front-end dependencies with nodejs. You need to install [yarn](https://yarnpkg.com/lang/en/docs/install/):
d7eb06bd
A
168
169```bash
170$ make build_frontend
171```
172
fdf88d19
A
173Optionally, you can delete information related to the legacy version:
174
175```bash
176$ git branch -D master
177Deleted branch master (was 029f75f).
178
179$ git remote remove sebsauvage
180
181$ git remote -v
182origin https://github.com/shaarli/Shaarli (fetch)
183origin https://github.com/shaarli/Shaarli (push)
184
185$ git gc
186Counting objects: 3317, done.
187Delta compression using up to 8 threads.
188Compressing objects: 100% (1237/1237), done.
189Writing objects: 100% (3317/3317), done.
190Total 3317 (delta 2050), reused 3301 (delta 2034)to
191```
192
91a21c27 193### Step 3: configuration
53ed6d7d 194
48679a15
V
195After migrating, access your fresh Shaarli installation from a web browser; the
196configuration will then be automatically updated, and new settings added to
91a21c27 197`data/config.json.php` (see [Shaarli configuration](Shaarli-configuration.md) for more
48679a15 198details).
b230bf20
A
199
200## Troubleshooting
201
91a21c27 202If the solutions provided here don't work, see [Troubleshooting](Troubleshooting.md) and/or open an issue specifying which version you're upgrading from and to.
b230bf20 203