find and replace fixes, will introduce errors

This commit is contained in:
Ariel Rin
2023-10-27 16:37:53 +10:00
parent b9d128259e
commit ffb526ab0c
52 changed files with 615 additions and 589 deletions

View File

@@ -4,8 +4,7 @@ This guide describes how to upgrade an existing Alliance Auth (AA) installation
This guide shares many similarities with the Alliance Auth install guide, but it is targeted towards existing installs needing to update.
```eval_rst
.. note::
:::{note}
This guide will upgrade the software components only but not change any data or configuration.
```
@@ -16,20 +15,19 @@ To run AA with a newer Python 3 version than your system's default you need to i
To install other Python versions than those included with your distribution, you need to add a new installation repository. Then you can install the specific Python 3 to your system.
Ubuntu 1804, 2004:
```eval_rst
.. note::
:::{note}
Ubuntu 2204 ships with Python 3.10 already
```
```bash
```shell
sudo add-apt-repository ppa:deadsnakes/ppa
```
```bash
```shell
sudo apt-get update
```
```bash
```shell
sudo apt-get install python3.10 python3.10-dev python3.10-venv
```
@@ -37,37 +35,36 @@ CentOS 7:
We need to build Python from source
Centos Stream 8/9:
```eval_rst
.. note::
:::{note}
A Python 3.9 Package is available for Stream 8 and 9. You _may_ use this instead of building your own package. But our documentation will assume Python3.10 and you may need to substitute as neccessary
sudo dnf install python39 python39-devel
```
```bash
```shell
cd ~
```
```bash
```shell
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget
```
```bash
```shell
wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz
```
```bash
```shell
tar xvf Python-3.10.5.tgz
```
```bash
```shell
cd Python-3.10.5/
```
```bash
```shell
./configure --enable-optimizations --enable-shared
```
```bash
```shell
sudo make altinstall
```
## Preparing your venv
@@ -76,8 +73,7 @@ Before updating your venv it is important to make sure that your current install
Start by navigating to your main project folder (the one that has `manage.py` in it). If you followed the default installation the path is: `/home/allianceserver/myauth`
```eval_rst
.. note::
:::{note}
If you installed Alliance Auth under the allianceserver user, as reccommended. Remember to switch users for easier permission management::
sudo su allianceserver
@@ -85,7 +81,7 @@ Start by navigating to your main project folder (the one that has `manage.py` in
Activate your venv:
```bash
```shell
source /home/allianceserver/venv/auth/bin/activate
```
@@ -93,23 +89,23 @@ source /home/allianceserver/venv/auth/bin/activate
Make sure to upgrade AA to the newest version:
```bash
```shell
pip install -U allianceauth
```
Run migrations and collectstatic.
```bash
```shell
python manage.py migrate
```
```bash
```shell
python manage.py collectstatic
```
Restart your AA supervisor:
```bash
```shell
supervisorctl restart myauth:
```
@@ -119,23 +115,23 @@ You also need to upgrade all additional apps to their newest version that you ha
If you unsure which apps you have installed from repos check `INSTALLED_APPS` in your settings. Alternatively run this command to get a list all apps in your venv.
```bash
```shell
pip list
```
Repeat as needed for your apps
```bash
```shell
pip install -U APP_NAME
```
Make sure to run migrations and collect static files for all upgraded apps.
```bash
```shell
python manage.py migrate
```
```bash
```shell
python manage.py collectstatic
```
### Restart and final check
@@ -144,13 +140,13 @@ Do a final restart of your AA supervisors and make sure your installation is sti
For a final check that they are no issues - e.g. any outstanding migrations - run this command:
```bash
```shell
python manage.py check
```
If you get the following result you are good to go. Otherwise make sure to fix any issues first before proceeding.
```bash
```shell
System check identified no issues (0 silenced).
```
@@ -160,7 +156,7 @@ Make sure you are in your venv!
First we create a list of all installed packages in your venv. You can use this list later as reference to see what packages should be installed.
```bash
```shell
pip freeze > requirements.txt
```
@@ -169,29 +165,28 @@ At this point we recommend creating a list of the additional packages that you n
- Community AA apps (e.g. aa-structures)
- Additional tools you are using (e.g. flower, django-extensions)
```eval_rst
```{eval-rst}
.. hint::
While `requirements.txt` will contain a complete list of your packages, it will also contain many packages that are automatically installed as dependencies and don't need be manually reinstalled.
```
```eval_rst
.. note::
:::{note}
Some guide on the Internet will suggest to use use the requirements.txt file to recreate a venv. This is indeed possible, but only works if all packages can be installed from PyPI. Since most community apps are installed directly from repos this guide will not follow that approach.
```
Leave the venv and shutdown all AA services:
```bash
```shell
deactivate
```
```bash
```shell
supervisorctl stop myauth:
```
Rename and keep your old venv so we have a fallback in case of some unforeseeable issues:
```bash
```shell
mv /home/allianceserver/venv/auth /home/allianceserver/venv/auth_old
```
@@ -199,11 +194,11 @@ mv /home/allianceserver/venv/auth /home/allianceserver/venv/auth_old
Now let's create our new venv with Python 3.10 and activate it:
```bash
```shell
python3.10 -m venv /home/allianceserver/venv/auth
```
```bash
```shell
source /home/allianceserver/venv/auth/bin/activate
```
@@ -213,17 +208,17 @@ Now we need to reinstall all packages into your new venv.
### Install basic packages
```bash
```shell
pip install -U pip setuptools wheel
```
### Installing AA & Gunicorn
```bash
```shell
pip install allianceauth
```
```bash
```shell
pip install gunicorn
```
@@ -235,13 +230,13 @@ Use the list of packages you created earlier as a checklist. Alternatively you u
To check whether you are missing any apps you can also run the check command:
```bash
```shell
python manage.py check
```
Note: In case you forget to install an app you will get this error
```bash
```shell
ModuleNotFoundError: No module named 'xyz'
```
@@ -251,7 +246,7 @@ Note that you should not need to run any migrations unless you forgot to upgrade
After you have completed installing all packages just start your AA supervisor again.
```bash
```shell
supervisorctl start myauth:
```
@@ -263,7 +258,7 @@ In case you run into any major issue you can always switch back to your initial
Before you start double-check that you still have your old venv for auth:
```bash
```shell
ls /home/allianceserver/venv/auth /home/allianceserver/venv
```
@@ -274,18 +269,18 @@ If the output shows these two folders you should be safe to proceed:
Run these commands to remove your current venv and switch back to the old venv for auth:
```bash
```shell
supervisorctl stop myauth:
```
```bash
```shell
rm -rf /home/allianceserver/venv/auth
```
```bash
```shell
mv /home/allianceserver/venv/auth_old /home/allianceserver/venv/auth
```
```bash
```shell
supervisorctl start myauth:
```