Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LePetitTim committed Apr 2, 2019
1 parent c2db855 commit 20c1cd8
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 128 deletions.
128 changes: 0 additions & 128 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,134 +78,6 @@ And access the application ``http://yourserver/``.
You will be prompted for login, jump to :ref:`loading data section <loading data>`,
to create the admin user and fill the database with your data!


Software update
---------------

WARNING:

Intermediate versions are required to upgrade your instance.

If your version is < 2.13.1, you need to install this version.

If your version is < 2.16.2, you need to install this version

All versions are published on `the Github forge <https://github.com/GeotrekCE/Geotrek-admin/releases>`_.
Download and extract the new version in a separate folder (**recommended**).

.. code-block:: bash
wget https://github.com/GeotrekCE/Geotrek-admin/archive/X.Y.Z.zip
unzip X.Y.Z.zip
cd Geotrek-X.Y.Z/
Before upgrading, **READ CAREFULLY** the release notes, either from the ``docs/changelog.rst``
files `or online <https://github.com/GeotrekCE/Geotrek-admin/releases>`_.

Shutdown previous running version :

::

# Shutdown previous version
sudo supervisorctl stop all


Copy your old configuration and uploaded files to your new folder.

::

# Configuration files
cp -aR ../previous-version/etc/ .

# Uploaded files
cp -aR ../previous-version/var/ .

# If you have advanced settings
cp ../previous-version/geotrek/settings/custom.py geotrek/settings/custom.py

# If you have import parsers
cp ../previous-version/bulkimport/parsers.py bulkimport/parsers.py

# If you have custom translations
cp -aR ../previous-version/geotrek/locale/ geotrek/

Deploy the new version :

::

# Re-run install
./install.sh

# Empty cache
sudo service memcached restart


Check the version on the login page !


:note:

Shutting down the current instance may not be necessary. But this allows us to
keep a generic software update procedure.

If you don't want to interrupt the service, skip the ``stop`` step, at your own risk.


Check out the :ref:`troubleshooting page<troubleshooting-section>` for common problems.


Server migration
----------------

It is a new installation with an additional backup/restore and a file transfert
in between. The commands below are examples to adapt to your actual configuration
(server names, database configuration).

Backup settings, media files and database on the old server:

::

cd Geotrek
sudo -u postgres pg_dump -Fc geotrekdb > geotrekdb.backup
tar cvzf data.tgz geotrekdb.backup bulkimport/parsers.py var/static/ var/media/paperclip/ var/media/upload/ var/media/templates/ etc/settings.ini geotrek/settings/custom.py

Get and unzip Geotrek sources on the new server:

::

wget https://github.com/GeotrekCE/Geotrek-admin/archive/2.0.0.zip
unzip 2.0.0.zip
mv Geotrek-2.0.0 Geotrek
cd Geotrek

Restore files on the new server:

::

scp old_server:Geotrek/data.tgz .
tar xvzf data.tgz

Then edit `etc/settings.ini` to update host variable and `geotrek/settings/custom.py`
to update IGN key.

Install Geotrek on the new server:

::

./install.sh

Restore database on the new server:

::

sudo supervisorctl stop all
sudo -u postgres psql -c "drop database geotrekdb;"
sudo -u postgres psql -c "create database geotrekdb owner geotrek;"
sudo -u postgres pg_restore -d geotrekdb geotrekdb.backup
make update
sudo supervisorctl start all


Tips and Tricks
---------------

Expand Down
52 changes: 52 additions & 0 deletions docs/server-migration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
================
Server Migration
================

The commands below are examples to adapt to your actual configuration
(server names, database configuration).

Backup settings, media files and database on the old server:

::

cd Geotrek
sudo -u postgres pg_dump -Fc geotrekdb > geotrekdb.backup
tar cvzf data.tgz geotrekdb.backup bulkimport/parsers.py var/static/ var/media/paperclip/ var/media/upload/ var/media/templates/ etc/settings.ini geotrek/settings/custom.py

Good example to know how to use pg_dump and pg_restore https://devcenter.heroku.com/articles/heroku-postgres-import-export

Get and unzip Geotrek sources on the new server:

::

wget https://github.com/GeotrekCE/Geotrek-admin/archive/2.0.0.zip
unzip 2.0.0.zip
mv Geotrek-2.0.0 Geotrek
cd Geotrek

Restore files on the new server:

::

scp old_server:Geotrek/data.tgz .
tar xvzf data.tgz

Then edit `etc/settings.ini` to update host variable and `geotrek/settings/custom.py`
to update IGN key.

Install Geotrek on the new server:

::

./install.sh

Restore database on the new server:

::

sudo supervisorctl stop all
sudo -u postgres psql -c "drop database geotrekdb;"
sudo -u postgres psql -c "create database geotrekdb owner geotrek;"
sudo -u postgres pg_restore -d geotrekdb geotrekdb.backup
make update
sudo supervisorctl start all
48 changes: 48 additions & 0 deletions docs/update-to-docker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
================
UPDATE TO DOCKER
================

These instructions will update *Geotrek* on a dedicated server with docker for production from a previous install
without docker.

First you should update at least to version 2.22.0 without docker.
Please folow this documentation :

WARNING:

Intermediate versions are required to upgrade your instance,

If your version is < 2.13.1, you need to install this version.

If your version is < 2.16.2, you need to install this version


Server migration docker
-----------------------

Follow the installation : ``docs/installation-docker.rst``
Do not forget to create the server in another folder and stop postgresql :
::
sudo service stop postgresql


Move your different settings/datas in the new folder
::
# Uploaded files
cp -aR ../previous-version/var ./var

# If you have advanced settings
cp ../previous-version/geotrek/settings/custom.py ./var/conf/custom.py

# If you have import parsers
cp ../previous-version/bulkimport/parsers.py ./var/conf/parsers.py

# If you have custom translations
cp -aR ../previous-version/geotrek/locale/ ./var/conf/extra_locale/

# If you have custom templates (example)
cp ../previous-version/geotrek/trekking/templates/trekking/trek_public_pdf.html ./var/conf/extra_templates/

Then you can run your geotrek : ````

Then you can upgrade your docker to new versions : ``docs/upgrade-docker.rst``
File renamed without changes.
72 changes: 72 additions & 0 deletions docs/upgrade.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
===============
Software update
===============

WARNING:

Intermediate versions are required to upgrade your instance.

If your version is < 2.13.1, you need to install this version.

If your version is < 2.16.2, you need to install this version

All versions are published on `the Github forge <https://github.com/GeotrekCE/Geotrek-admin/releases>`_.
Download and extract the new version in a separate folder (**recommended**).

.. code-block:: bash
wget https://github.com/GeotrekCE/Geotrek-admin/archive/X.Y.Z.zip
unzip X.Y.Z.zip
cd Geotrek-X.Y.Z/
Before upgrading, **READ CAREFULLY** the release notes, either from the ``docs/changelog.rst``
files `or online <https://github.com/GeotrekCE/Geotrek-admin/releases>`_.

Shutdown previous running version :

::

# Shutdown previous version
sudo supervisorctl stop all


Copy your old configuration and uploaded files to your new folder.

::

# Configuration files
cp -aR ../previous-version/etc/ .

# Uploaded files
cp -aR ../previous-version/var/ .

# If you have advanced settings
cp ../previous-version/geotrek/settings/custom.py geotrek/settings/custom.py

# If you have import parsers
cp ../previous-version/bulkimport/parsers.py bulkimport/parsers.py

# If you have custom translations
cp -aR ../previous-version/geotrek/locale/ geotrek/

Deploy the new version :

::

# Re-run install
./install.sh

# Empty cache
sudo service memcached restart


Check the version on the login page !

:note:

Shutting down the current instance may not be necessary. But this allows us to
keep a generic software update procedure.

If you don't want to interrupt the service, skip the ``stop`` step, at your own risk.

Check out the :ref:`troubleshooting page<troubleshooting-section>` for common problems.

0 comments on commit 20c1cd8

Please sign in to comment.