Update Existing Installation

Updating a local installation of the ErbslandFORMER application requires a few straightforward steps. Follow the instructions below to ensure a smooth update process.

  1. Stop the Apache Web Server

    Connect to the server and stop the Apache web server.

    test@erbsland-former:~$ sudo systemctl stop apache2
    
  2. Switch to the Application User and Navigate to the Application Directory

    Change to the application user and set the current directory to the application directory.

    test@erbsland-former:~$ sudo su erbsland_former
    erbsland_former@erbsland-former:/home/test$ cd /var/www/erbsland-former/app/
    erbsland_former@erbsland-former:/var/www/erbsland-former/app$ 
  3. Activate the Python Virtual Environment

    Activate the Python virtual environment.

    $ source /var/www/erbsland-former/venv/bin/activate
    $ 
  4. Stash Any Local Changes

    If there are any local changes, make sure to stash them.

    $ git stash
    Saved working directory and index state WIP on main: 7c66a87 Preparation for release version.
    $ 
  5. Pull the Latest Version of the Application

    Pull the latest version of the application from the repository.

    $ git pull
    Updating a1d1368..7c66a87
    Fast-forward
    (...)
    $ 
  6. Reapply Stashed Changes (If Any)

    If you have stashed any changes, re-apply them and remove the stash.

    $ git stash pop
    (...)
    $ 
  7. Set the Environment Variable for Custom Settings

    Set the environment variable for your custom settings module.

    $ export DJANGO_SETTINGS_MODULE=ErbslandFormer.my_settings
    $ 
  8. Update Static Files

    Update the static files. In most cases, nothing will change.

    $ python manage.py collectstatic
    
    You have requested to collect static files at the destination
    location as specified in your settings:
    
        /var/www/erbsland-former/static
    
    This will overwrite existing files!
    Are you sure you want to do this?
    
    Type 'yes' to continue, or 'no' to cancel: yes
    
    3 static files copied to '/var/www/erbsland-former/static', 186 unmodified.
    $ 
  9. Migrate the Database

    Migrate the database. In most cases, there are no migrations required.

    $ python manage.py migrate
    (...)
    $ 
  10. Exit the Application User Shell and Restart Apache

    Exit the application user shell and restart Apache.

    (venv) erbsland_former@erbsland-former:/var/www/erbsland-former/app$ exit
    test@erbsland-former:~$ sudo systemctl start apache2
    test@erbsland-former:~$ 

You have now successfully updated your ErbslandFORMER application.