Compare commits

...

23 Commits

Author SHA1 Message Date
Ariel Rin
5e14ea4573 Version Bump 3.5.0 2023-07-11 13:01:50 +10:00
Ariel Rin
c743eca0f7 Merge branch 'fix-use-of-deprecated-function-calls' into 'master'
[FIX] Use of deprecated `logger.warn()` function calls

See merge request allianceauth/allianceauth!1516
2023-07-11 02:36:59 +00:00
Ariel Rin
2002f24178 Merge branch 'limit-django-registration' into 'master'
[COMPATIBILITY] Limit `django-registration` to <3.4

See merge request allianceauth/allianceauth!1512
2023-07-07 23:57:30 +00:00
Ariel Rin
6412aedf53 Merge branch 'add-docs-for-external-link' into 'master'
Add customization example to docs

See merge request allianceauth/allianceauth!1511
2023-07-07 23:56:07 +00:00
Erik Kalkoken
939df08b95 Add customization example to docs 2023-07-07 23:56:07 +00:00
Ariel Rin
d8506aa753 Merge branch 'pkg-config' into 'master'
add pkg-config to our system package dependencies, for mysqlclient 2.2.0

Closes #1376

See merge request allianceauth/allianceauth!1509
2023-07-07 23:54:41 +00:00
Ariel Rin
3f2cdac658 Merge branch 'devdocs-1' into 'master'
Add pkg-config install to dev setup and expand python downgrade note.

See merge request allianceauth/allianceauth!1510
2023-07-07 23:54:39 +00:00
Peter Pfeufer
d57ab01ff3 [FIX] Use of deprecated logger.warn() function calls 2023-07-07 17:51:55 +02:00
Peter Pfeufer
91b62bbe9d [COMPATIBILITY] Limit django-registration to <3.4 2023-07-04 12:51:12 +02:00
Max Tsero
557a52e3c8 Add pkg-config install to dev setup and expand python downgrade note. 2023-07-02 10:39:23 +00:00
Ariel Rin
f8fefd92a5 add pkg-config to our system package dependencies, for mysqlclient 2.2.0 2023-06-27 11:08:59 +10:00
Ariel Rin
f2c43ee921 Merge branch 'add-docs-app-unintall' into 'master'
Improve documentation for app removal

See merge request allianceauth/allianceauth!1508
2023-06-20 14:34:32 +00:00
Erik Kalkoken
99945b0146 Improve documentation for app removal 2023-06-20 14:34:32 +00:00
Ariel Rin
abb9dc4db6 Merge branch 'master' into 'master'
Add utf8mb4 unicode option to mysql config in local.py

See merge request allianceauth/allianceauth!1503
2023-06-03 07:04:52 +00:00
Valiantiam
eba5b80cde Add utf8mb4 unicode option to mysql config in local.py 2023-06-03 07:04:52 +00:00
Ariel Rin
5b39c887a5 Merge branch 'master' into 'master'
Add Grafana datasoure and dashboard provisioning

See merge request allianceauth/allianceauth!1501
2023-06-03 05:06:23 +00:00
Ariel Rin
183363e789 Merge branch 'add-ukrainian-to-userprofile-language-selection' into 'master'
[ADDED] Ukrainian to `UserProfile.LANGUAGE_CHOICES`

See merge request allianceauth/allianceauth!1505
2023-06-03 05:04:34 +00:00
Ariel Rin
d8704f4d8f Merge branch 'add-ipv6-to-nginx-config' into 'master'
[ADDED] IPv6 to Nginx config

See merge request allianceauth/allianceauth!1506
2023-06-03 05:03:17 +00:00
Peter Pfeufer
165ee44a63 [ADDED] IPv6 to Nginx config
IPv6 is almost 25 years old, time to add it to our config …
2023-05-31 09:29:04 +02:00
Peter Pfeufer
e8f508cecb [CHANGE] Switched to more modern models.TextChoices class for languages 2023-05-28 18:31:50 +02:00
Peter Pfeufer
3044f18900 [ADDED] Ukrainian to UserProfile.LANGUAGE_CHOICES 2023-05-28 17:38:51 +02:00
MillerUk
79637020f3 add grafana datasoure and dashboard provisioning 2023-05-16 22:14:11 +00:00
MillerUk
2d34422e2d add grafana datasoure and dashboard provisioning 2023-04-30 20:32:40 +00:00
21 changed files with 261 additions and 37 deletions

View File

@@ -25,7 +25,7 @@ before_script:
pre-commit-check:
<<: *only-default
stage: pre-commit
image: python:3.8-bullseye
image: python:3.10-bullseye
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:

View File

@@ -1,7 +1,7 @@
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
__version__ = '3.4.0'
__version__ = '3.5.0'
__title__ = 'Alliance Auth'
__url__ = 'https://gitlab.com/allianceauth/allianceauth'
NAME = f'{__title__} v{__version__}'

View File

@@ -0,0 +1,34 @@
# Generated by Django 4.0.10 on 2023-05-28 15:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("authentication", "0020_userprofile_language_userprofile_night_mode"),
]
operations = [
migrations.AlterField(
model_name="userprofile",
name="language",
field=models.CharField(
blank=True,
choices=[
("en", "English"),
("de", "German"),
("es", "Spanish"),
("zh-hans", "Chinese Simplified"),
("ru", "Russian"),
("ko", "Korean"),
("fr", "French"),
("ja", "Japanese"),
("it", "Italian"),
("uk", "Ukrainian"),
],
default="",
max_length=10,
verbose_name="Language",
),
),
]

View File

@@ -63,6 +63,22 @@ class UserProfile(models.Model):
class Meta:
default_permissions = ('change',)
class Language(models.TextChoices):
"""
Choices for UserProfile.language
"""
ENGLISH = 'en', _('English')
GERMAN = 'de', _('German')
SPANISH = 'es', _('Spanish')
CHINESE = 'zh-hans', _('Chinese Simplified')
RUSSIAN = 'ru', _('Russian')
KOREAN = 'ko', _('Korean')
FRENCH = 'fr', _('French')
JAPANESE = 'ja', _('Japanese')
ITALIAN = 'it', _('Italian')
UKRAINIAN = 'uk', _('Ukrainian')
user = models.OneToOneField(
User,
related_name='profile',
@@ -76,20 +92,9 @@ class UserProfile(models.Model):
State,
on_delete=models.SET_DEFAULT,
default=get_guest_state_pk)
LANGUAGE_CHOICES = [
('en', _('English')),
('de', _('German')),
('es', _('Spanish')),
('zh-hans', _('Chinese Simplified')),
('ru', _('Russian')),
('ko', _('Korean')),
('fr', _('French')),
('ja', _('Japanese')),
('it', _('Italian')),
]
language = models.CharField(
_("Language"), max_length=10,
choices=LANGUAGE_CHOICES,
choices=Language.choices,
blank=True,
default='')
night_mode = models.BooleanField(

View File

@@ -57,7 +57,7 @@ def hr_application_create_view(request, form_id=None):
app_form = get_object_or_404(ApplicationForm, id=form_id)
if request.method == "POST":
if Application.objects.filter(user=request.user).filter(form=app_form).exists():
logger.warn(f"User {request.user} attempting to duplicate application to {app_form.corp}")
logger.warning(f"User {request.user} attempting to duplicate application to {app_form.corp}")
else:
application = Application(user=request.user, form=app_form)
application.save()
@@ -92,7 +92,7 @@ def hr_application_personal_view(request, app_id):
}
return render(request, 'hrapplications/view.html', context=context)
else:
logger.warn(f"User {request.user} not authorized to view {app}")
logger.warning(f"User {request.user} not authorized to view {app}")
return redirect('hrapplications:personal_view')
@@ -105,9 +105,9 @@ def hr_application_personal_removal(request, app_id):
logger.info(f"User {request.user} deleting {app}")
app.delete()
else:
logger.warn(f"User {request.user} attempting to delete reviewed app {app}")
logger.warning(f"User {request.user} attempting to delete reviewed app {app}")
else:
logger.warn(f"User {request.user} not authorized to delete {app}")
logger.warning(f"User {request.user} not authorized to delete {app}")
return redirect('hrapplications:index')
@@ -132,7 +132,7 @@ def hr_application_view(request, app_id):
logger.info(f"Saved comment by user {request.user} to {app}")
return redirect('hrapplications:view', app_id)
else:
logger.warn("User %s does not have permission to add ApplicationComments" % request.user)
logger.warning("User %s does not have permission to add ApplicationComments" % request.user)
return redirect('hrapplications:view', app_id)
else:
logger.debug("Returning blank HRApplication comment form.")
@@ -171,7 +171,7 @@ def hr_application_approve(request, app_id):
app.save()
notify(app.user, "Application Accepted", message="Your application to %s has been approved." % app.form.corp, level="success")
else:
logger.warn(f"User {request.user} not authorized to approve {app}")
logger.warning(f"User {request.user} not authorized to approve {app}")
return redirect('hrapplications:index')
@@ -187,7 +187,7 @@ def hr_application_reject(request, app_id):
app.save()
notify(app.user, "Application Rejected", message="Your application to %s has been rejected." % app.form.corp, level="danger")
else:
logger.warn(f"User {request.user} not authorized to reject {app}")
logger.warning(f"User {request.user} not authorized to reject {app}")
return redirect('hrapplications:index')
@@ -208,7 +208,7 @@ def hr_application_search(request):
app_list = app_list.filter(
form__corp__corporation_id=request.user.profile.main_character.corporation_id)
except AttributeError:
logger.warn(
logger.warning(
"User %s missing main character model: unable to filter applications to search" % request.user)
applications = app_list.filter(
@@ -246,6 +246,6 @@ def hr_application_mark_in_progress(request, app_id):
app.save()
notify(app.user, "Application In Progress", message=f"Your application to {app.form.corp} is being reviewed by {app.reviewer_str}")
else:
logger.warn(
logger.warning(
f"User {request.user} unable to mark {app} in progress: already being reviewed by {app.reviewer}")
return redirect("hrapplications:view", app_id)

View File

@@ -44,7 +44,7 @@ def notification_view(request, notif_id):
notif.mark_viewed()
return render(request, 'notifications/view.html', context)
else:
logger.warn(
logger.warning(
"User %s not authorized to view notif_id %s belonging to user %s",
request.user,
notif_id, notif.user

View File

@@ -49,7 +49,7 @@ class DiscourseTasks:
DiscourseManager.update_groups(user)
except Exception as e:
logger.exception(e)
logger.warn("Discourse group sync failed for %s, retrying in 10 mins" % user)
logger.warning("Discourse group sync failed for %s, retrying in 10 mins" % user)
raise self.retry(countdown=60 * 10)
logger.debug("Updated user %s discourse groups." % user)

View File

@@ -176,7 +176,7 @@ class Phpbb3Manager:
logger.debug(f"Proceeding to add phpbb user {username_clean} and pwhash starting with {pwhash[0:5]}")
# check if the username was simply revoked
if Phpbb3Manager.check_user(username_clean):
logger.warn("Unable to add phpbb user with username %s - already exists. Updating user instead." % username)
logger.warning("Unable to add phpbb user with username %s - already exists. Updating user instead." % username)
Phpbb3Manager.__update_user_info(username_clean, email, pwhash)
else:
try:

View File

@@ -44,7 +44,7 @@ def activate_teamspeak3(request):
def verify_teamspeak3(request):
logger.debug("verify_teamspeak3 called by user %s" % request.user)
if not Teamspeak3Tasks.has_account(request.user):
logger.warn("Unable to validate user %s teamspeak: no teamspeak data" % request.user)
logger.warning("Unable to validate user %s teamspeak: no teamspeak data" % request.user)
return redirect("services:services")
if request.method == "POST":
form = TeamspeakJoinForm(request.POST)

View File

@@ -1,7 +1,7 @@
PROTOCOL=https://
AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN%
DOMAIN=%DOMAIN%
AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v3.4.0
AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v3.5.0
# Nginx Proxy Manager
PROXY_HTTP_PORT=80
@@ -21,6 +21,7 @@ AA_DB_NAME=alliance_auth
AA_DB_USER=aauth
AA_DB_PASSWORD=%AA_DB_PASSWORD%
AA_DB_ROOT_PASSWORD=%AA_DB_ROOT_PASSWORD%
AA_DB_CHARSET=utf8mb4
AA_EMAIL_HOST=''
AA_EMAIL_PORT=587
AA_EMAIL_HOST_USER=''

View File

@@ -1,5 +1,5 @@
FROM python:3.9-slim
ARG AUTH_VERSION=v3.4.0
ARG AUTH_VERSION=v3.5.0
ARG AUTH_PACKAGE=allianceauth==${AUTH_VERSION}
ENV VIRTUAL_ENV=/opt/venv
ENV AUTH_USER=allianceauth

View File

@@ -17,6 +17,9 @@ DATABASES["default"] = {
"PASSWORD": os.environ.get("AA_DB_PASSWORD"),
"HOST": os.environ.get("AA_DB_HOST"),
"PORT": os.environ.get("AA_DB_PORT", "3306"),
"OPTIONS": {
"charset": os.environ.get("AA_DB_CHARSET", "utf8mb4")
}
}
# Register an application at https://developers.eveonline.com for Authentication

View File

@@ -57,7 +57,14 @@ services:
depends_on:
- auth_mysql
volumes:
- ./grafana-datasource.yml:/etc/grafana/provisioning/datasources/datasource.yaml
- ./grafana-dashboards.yml:/etc/grafana/provisioning/dashboards/datasource.yaml
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
environment:
GF_INSTALL_PLUGINS: grafana-piechart-panel,grafana-clock-panel,grafana-simple-json-datasource
GF_AUTH_DATABASE_PASSWORD: ${GRAFANA_DB_PASSWORD}
proxy:
image: 'jc21/nginx-proxy-manager:latest'
restart: always

View File

@@ -0,0 +1,25 @@
apiVersion: 1
providers:
# <string> an unique provider name
- name: 'auth dashboards'
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string, required> name of the dashboard folder. Required
folder: ''
# <string> folder UID. will be automatically generated if not specified
folderUid: ''
# <string, required> provider type. Required
type: file
# <bool> disable dashboard deletion
disableDeletion: false
# <bool> enable dashboard editing
editable: true
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 10
# <bool> allow updating provisioned dashboards from the UI
allowUiUpdates: false
options:
# <string, required> path to dashboard files on disk. Required
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true

View File

@@ -0,0 +1,12 @@
apiVersion: 1
datasources:
- name: MySQL
type: mysql
url: auth_mysql
database: alliance_auth
user: grafana
editable: true
secureJsonData:
password: ${GF_AUTH_DATABASE_PASSWORD}

View File

@@ -71,3 +71,51 @@ urlpatterns = [
re_path(r'', include(allianceauth.urls)),
]
```
## Example: Adding an external link to the sidebar
As an example we are adding an external links to the Alliance Auth sidebar using the template overrides feature. For our example let's add a link to Google's start page.
### Step 1 - Create the template override folder
First you need to create the folder for the template on your server. For AA to pick it up it has to match a specific structure.
If you have a default installation you can create the folder like this:
```sh
mkdir -p /home/allianceserver/myauth/myauth/templates/allianceauth
```
### Step 2 - Download the original template
Next you need to download a copy of the original template file we want to change. For that let's move into the above folder and then download the file into the current folder with:
```sh
cd /home/allianceserver/myauth/myauth/templates/allianceauth
wget <https://gitlab.com/allianceauth/allianceauth/-/raw/master/allianceauth/templates/allianceauth/side-menu.html>
```
### Step 3 - Modify the template
Now you can modify the template to add your custom link. To create the google link we can add this snippet *between* the `{% menu_items %}` and the `</ul>` tag:
```sh
nano /home/allianceserver/myauth/myauth/templates/allianceauth/side-menu.html
```
```jinja
<li>
<a href="https://www.google.com/" target="_blank">
<i class="fab fa-google fa-fw"></i>Google
</a>
</li>
```
```eval_rst
.. hint::
You can find other icons with a matching style on the `Font Awesome site <https://fontawesome.com/v5/search?m=free>`_ . AA currently uses Font Awesome version 5. You also want to keep the ``fa-fw`` tag to ensure all icons have the same width.
```
### Step 4 - Restart your AA services
Finally, restart your AA services and your custom link should appear in the sidebar.

View File

@@ -82,6 +82,10 @@ Next we need to install Python and related development tools.
.. note::
Should your Ubuntu come with a newer version of Python we recommend to still setup your dev environment with the oldest Python 3 version currently supported by AA (e.g Python 3.8 at this time of writing) to ensure your apps are compatible with all current AA installations
You an check out this `page <https://askubuntu.com/questions/682869/how-do-i-install-a-different-python-version-using-apt-get/1195153>`_ on how to install additional Python versions on Ubuntu.
If you install a different python version from the default you need to adjust some of the commands below to install appopriate versions of those packages for example using Python 3.8 you might need to run the following after using the setup steps for the repository mentioned in the AskUbuntu post above:
`sudo apt-get install python3.8 python3.8-dev python3.8-venv python3-setuptools python3-pip python-pip`
```
Use the following command to install Python 3 with all required libraries with the default version:
@@ -93,7 +97,7 @@ sudo apt-get install python3 python3-dev python3-venv python3-setuptools python3
### Install redis and other tools
```bash
sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev
sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev pkg-config
```
Start redis

View File

@@ -220,13 +220,13 @@ A few extra utilities are also required for installation of packages.
Ubuntu 1804, 2004, 2204:
```bash
sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev build-essential
sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev build-essential pkg-config
```
CentOS 7:
```bash
sudo yum install gcc gcc-c++ unzip git redis curl bzip2-devel openssl-devel libffi-devel wget
sudo yum install gcc gcc-c++ unzip git redis curl bzip2-devel openssl-devel libffi-devel wget pkg-config
```
```bash

View File

@@ -79,6 +79,8 @@ Copy this basic config into your config file. Make whatever changes you feel are
```
server {
listen 80;
listen [::]:80;
server_name example.com;
location = /favicon.ico { access_log off; log_not_found off; }
@@ -110,6 +112,7 @@ Your config will need a few additions once you've got your certificate.
```
listen 443 ssl http2; # Replace listen 80; with this
listen [::]:443 ssl http2; # Replace listen [::]:80; with this
ssl_certificate /path/to/your/cert.crt;
ssl_certificate_key /path/to/your/cert.key;
@@ -126,6 +129,8 @@ If you want to redirect all your non-SSL visitors to your secure site, below you
```
server {
listen 80;
listen [::]:80;
server_name example.com;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.

View File

@@ -1,15 +1,95 @@
# App Maintenance
## Adding and Removing Apps
## Adding Apps
Your auth project is just a regular Django project - you can add in [other Django apps](https://djangopackages.org/) as desired. Most come with dedicated setup guides, but here is the general procedure:
1. add `'appname',` to your `INSTALLED_APPS` setting in `local.py`
2. run `python manage.py migrate`
3. run `python manage.py collectstatic`
3. run `python manage.py collectstatic --noinput`
4. restart AA with `supervisorctl restart myauth:`
If you ever want to remove an app, you should first clear it from the database to avoid dangling foreign keys: `python manage.py migrate appname zero`. Then you can remove it from your auth project's `INSTALLED_APPS` list.
## Removing Apps
The following instructions will explain how you can remove an app properly fom your Alliance Auth installation.
```eval_rst
.. note::
We recommend following these instructions to avoid dangling foreign keys or orphaned Python packages on your system, which might cause conflicts with other apps down the road.
```
### Step 1 - Removing database tables
First, we want to remove the app related tables from the database.
#### Automatic table removal
Let's first try the automatic approach by running the following command:
```sh
python manage.py migrate appname zero
```
If that worked you'll get a confirmation message.
If that did not work and you got error messages, you will need to remove the tables manually. This is pretty common btw, because many apps use sophisticated table setups, which can not be removed automatically by Django.
#### Manual table removal
First, tell Django that these migrations are no longer in effect (note the additional `--fake`):
```sh
python manage.py migrate appname zero --fake
```
Then, open the mysql tool and connect to your Alliance Auth database:
```sh
sudo mysql -u root
use alliance_auth;
```
Next disable foreign key check. This makes it much easier to drop tables in any order.
```sh
SET FOREIGN_KEY_CHECKS=0;
```
Then get a list of all tables. All tables belonging to the app in question will start with `appname_`.
```sh
show tables;
```
Now, drop the tables from the app one by one like so:
```sh
drop table appname_model_1;
drop table appname_model_2;
...
```
And finally, but very importantly, re-enable foreign key checks again and then exit:
```sh
SET FOREIGN_KEY_CHECKS=1;
exit;
```
### Step 2 - Remove the app from Alliance Auth
Once the tables have been removed, you you can remove the app from Alliance Auth. This is done by removing the applabel from the `INSTALLED_APPS` list in your local settings file.
### Step 3 - Remove the Python package
Finally, we want to remove the app's Python package. For that run the following command:
```sh
pip uninstall app-package-name
```
Congrats, you have now removed this app from your Alliance Auth installation.
## Permission Cleanup

View File

@@ -7,7 +7,7 @@ long_description_content_type = text/markdown
author = Alliance Auth
author_email = adarnof@gmail.com
license = GPL-2.0
license_file = LICENSE
license_files = LICENSE
classifiers =
Environment :: Web Environment
Framework :: Django
@@ -44,7 +44,7 @@ install_requires =
django-celery-beat>=2.3.0
django-esi>=4.0.1
django-redis>=5.2.0
django-registration>=3.3
django-registration>=3.3,<3.4
django-sortedm2m
dnspython
mysqlclient>=2.1.0