Compare commits

...

17 Commits

Author SHA1 Message Date
Joel Falknau
10dac36dcc Version Bump 5.0.0a3 2025-05-24 16:12:40 +10:00
Joel Falknau
0ff17de419 make markdownlint happy 2025-05-24 15:59:20 +10:00
Joel Falknau
6ee6986174 Version Bump 5.0.0a2 2025-05-24 15:54:54 +10:00
Joel Falknau
49364e7d27 test not needed, feature removed 2025-05-24 15:53:15 +10:00
Joel Falknau
f15c4fc708 keep on demand for pipeline reasons 2025-05-24 15:52:48 +10:00
Joel Falknau
6452b082a8 use new user-agent generator, drop specfile 2025-05-24 15:34:37 +10:00
Joel Falknau
daaffaeabc use token subset cleanup task from Django-ESI 7 2025-05-24 15:33:59 +10:00
Joel Falknau
95608db611 bump libs to support dj52, notably django-esi 7 2025-05-24 15:33:44 +10:00
Joel Falknau
523aac6a08 drop Ruff, i thought it was cool, kinda unnecessary 2025-05-24 15:31:54 +10:00
Joel Falknau
49a271a99f update pre-commit 2025-04-07 14:04:06 +10:00
Joel Falknau
af87da876b Celery 5.5 + shutdown timeouts 2025-04-07 14:01:33 +10:00
Joel Falknau
57b3841293 internal network port only 2025-04-07 13:57:57 +10:00
Joel Falknau
b02413c30c Type Hints 2025-03-26 13:27:01 +10:00
Joel Falknau
7ba1699dc6 Bring these in line with modern Django 2025-03-26 13:19:25 +10:00
Joel Falknau
75d67aa1b1 typehints 2025-03-26 13:18:54 +10:00
Joel Falknau
876f1e48e7 Update docs to python312, drop old OS 2025-03-06 11:28:19 +10:00
Joel Falknau
c7db4f0bd3 tox pre-commit formatter 2025-03-06 09:59:08 +10:00
40 changed files with 207 additions and 491 deletions

View File

@@ -24,20 +24,14 @@ exclude: |
) )
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit # Code Upgrades
rev: v0.9.9
hooks:
# Run the linter, and only the linter
- id: ruff
- repo: https://github.com/adamchainz/django-upgrade - repo: https://github.com/adamchainz/django-upgrade
rev: 1.23.1 rev: 1.25.0
hooks: hooks:
- id: django-upgrade - id: django-upgrade
args: [--target-version=5.1] args: [--target-version=5.2]
- repo: https://github.com/asottile/pyupgrade
- repo: https://github.com/asottile/pyupgrade # Ruff doesnt get everything. rev: v3.20.0
rev: v3.19.1
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py310-plus] args: [--py310-plus]
@@ -73,30 +67,31 @@ repos:
- id: check-executables-have-shebangs - id: check-executables-have-shebangs
- id: end-of-file-fixer - id: end-of-file-fixer
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python - repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.2.0 rev: 3.2.1
hooks: hooks:
- id: editorconfig-checker - id: editorconfig-checker
- repo: https://github.com/igorshubovych/markdownlint-cli - repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.44.0 rev: v0.45.0
hooks: hooks:
- id: markdownlint - id: markdownlint
language: node language: node
args: args:
- --disable=MD013 - --disable=MD013
# Infrastructure # Infrastructure
- repo: https://github.com/tox-dev/pyproject-fmt - repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.0 rev: v2.6.0
hooks: hooks:
- id: pyproject-fmt - id: pyproject-fmt
name: pyproject.toml formatter
description: "Format the pyproject.toml file."
args: args:
- --indent=4 - --indent=4
additional_dependencies: additional_dependencies:
- tox==4.24.1 # https://github.com/tox-dev/tox/releases/latest - tox==4.26.0 # https://github.com/tox-dev/tox/releases/latest
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.5.0
hooks:
- id: tox-ini-fmt
- repo: https://github.com/abravalheri/validate-pyproject - repo: https://github.com/abravalheri/validate-pyproject
rev: v0.23 rev: v0.24.1
hooks: hooks:
- id: validate-pyproject - id: validate-pyproject
name: Validate pyproject.toml
description: "Validate the pyproject.toml file."

View File

@@ -5,7 +5,7 @@ manage online service access.
# This will make sure the app is always imported when # This will make sure the app is always imported when
# Django starts so that shared_task will use this app. # Django starts so that shared_task will use this app.
__version__ = '5.0.0a1' __version__ = '5.0.0a3'
__title__ = 'Alliance Auth' __title__ = 'AllianceAuth'
__url__ = 'https://gitlab.com/allianceauth/allianceauth' __url__ = 'https://gitlab.com/allianceauth/allianceauth'
NAME = f'{__title__} v{__version__}' NAME = f'{__title__} v{__version__}'

View File

@@ -32,7 +32,7 @@ class State(models.Model):
class Meta: class Meta:
ordering = ['-priority'] ordering = ['-priority']
def __str__(self): def __str__(self) -> str:
return self.name return self.name
def available_to_character(self, character): def available_to_character(self, character):
@@ -153,7 +153,7 @@ class CharacterOwnership(models.Model):
class Meta: class Meta:
default_permissions = ('change', 'delete') default_permissions = ('change', 'delete')
ordering = ['user', 'character__character_name'] ordering = ['user', 'character__character_name']
def __str__(self): def __str__(self) -> str:
return f"{self.user}: {self.character}" return f"{self.user}: {self.character}"
@@ -166,5 +166,5 @@ class OwnershipRecord(models.Model):
class Meta: class Meta:
ordering = ['-created'] ordering = ['-created']
def __str__(self): def __str__(self) -> str:
return f"{self.user}: {self.character} on {self.created}" return f"{self.user}: {self.character} on {self.created}"

View File

@@ -45,7 +45,7 @@ class CorpStats(models.Model):
def __str__(self): def __str__(self) -> str:
return f"{self.__class__.__name__} for {self.corp}" return f"{self.__class__.__name__} for {self.corp}"
def update(self): def update(self):
@@ -154,7 +154,7 @@ class CorpMember(models.Model):
unique_together = ('corpstats', 'character_id') unique_together = ('corpstats', 'character_id')
ordering = ['character_name'] ordering = ['character_name']
def __str__(self): def __str__(self) -> str:
return self.character_name return self.character_name
@property @property

View File

@@ -81,7 +81,7 @@ class AutogroupsConfig(models.Model):
objects = AutogroupsConfigManager() objects = AutogroupsConfigManager()
def __str__(self): def __str__(self) -> str:
return 'States: ' + (' '.join(list(self.states.all().values_list('name', flat=True))) if self.pk else str(None)) return 'States: ' + (' '.join(list(self.states.all().values_list('name', flat=True))) if self.pk else str(None))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@@ -235,7 +235,7 @@ class ManagedGroup(models.Model):
class Meta: class Meta:
abstract = True abstract = True
def __str__(self): def __str__(self) -> str:
return f"Managed Group: {self.group.name}" return f"Managed Group: {self.group.name}"
class ManagedCorpGroup(ManagedGroup): class ManagedCorpGroup(ManagedGroup):

View File

@@ -32,7 +32,7 @@ class EveFactionInfo(models.Model):
provider = providers.provider provider = providers.provider
def __str__(self): def __str__(self) -> str:
return self.faction_name return self.faction_name
@staticmethod @staticmethod
@@ -80,7 +80,7 @@ class EveAllianceInfo(models.Model):
class Meta: class Meta:
indexes = [models.Index(fields=['executor_corp_id',])] indexes = [models.Index(fields=['executor_corp_id',])]
def __str__(self): def __str__(self) -> str:
return self.alliance_name return self.alliance_name
def populate_alliance(self): def populate_alliance(self):
alliance = self.provider.get_alliance(self.alliance_id) alliance = self.provider.get_alliance(self.alliance_id)
@@ -152,7 +152,7 @@ class EveCorporationInfo(models.Model):
class Meta: class Meta:
indexes = [models.Index(fields=['ceo_id',]),] indexes = [models.Index(fields=['ceo_id',]),]
def __str__(self): def __str__(self) -> str:
return self.corporation_name return self.corporation_name
def update_corporation(self, corp: providers.Corporation = None): def update_corporation(self, corp: providers.Corporation = None):
if corp is None: if corp is None:
@@ -226,7 +226,7 @@ class EveCharacter(models.Model):
models.Index(fields=['faction_id',]), models.Index(fields=['faction_id',]),
] ]
def __str__(self): def __str__(self) -> str:
return self.character_name return self.character_name
@property @property

View File

@@ -1,6 +1,7 @@
import logging import logging
import os import os
from bravado.client import SwaggerClient
from bravado.exception import HTTPError, HTTPNotFound, HTTPUnprocessableEntity from bravado.exception import HTTPError, HTTPNotFound, HTTPUnprocessableEntity
from jsonschema.exceptions import RefResolutionError from jsonschema.exceptions import RefResolutionError
@@ -8,7 +9,7 @@ from django.conf import settings
from esi.clients import esi_client_factory from esi.clients import esi_client_factory
from allianceauth import __version__ from allianceauth import __version__, __title__, __url__
from allianceauth.utils.django import StartupCommand from allianceauth.utils.django import StartupCommand
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname( SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(
@@ -36,7 +37,7 @@ class ObjectNotFound(Exception):
self.id = obj_id self.id = obj_id
self.type = type_name self.type = type_name
def __str__(self): def __str__(self) -> str:
return f'{self.type} with ID {self.id} not found.' return f'{self.type} with ID {self.id} not found.'
@@ -46,7 +47,7 @@ class Entity:
self.id = id self.id = id
self.name = name self.name = name
def __str__(self): def __str__(self) -> str:
return self.name return self.name
def __repr__(self): def __repr__(self):
@@ -175,7 +176,11 @@ class EveProvider:
class EveSwaggerProvider(EveProvider): class EveSwaggerProvider(EveProvider):
def __init__(self, token=None, adapter=None): def __init__(self, token=None, adapter=None) -> None:
self._token = token
self.adapter = adapter or self
self._faction_list = None # what are the odds this will change? could cache forever!
if settings.DEBUG or StartupCommand().is_management_command: if settings.DEBUG or StartupCommand().is_management_command:
self._client = None self._client = None
logger.info('ESI client will be loaded on-demand') logger.info('ESI client will be loaded on-demand')
@@ -183,9 +188,10 @@ class EveSwaggerProvider(EveProvider):
logger.info('Loading ESI client') logger.info('Loading ESI client')
try: try:
self._client = esi_client_factory( self._client = esi_client_factory(
token=token, token=self._token,
spec_file=SWAGGER_SPEC_PATH, ua_appname=__title__,
app_info_text=f"allianceauth v{__version__}" ua_version=__version__,
ua_url=__url__,
) )
except (HTTPError, RefResolutionError): except (HTTPError, RefResolutionError):
logger.exception( logger.exception(
@@ -194,19 +200,18 @@ class EveSwaggerProvider(EveProvider):
) )
self._client = None self._client = None
self._token = token
self.adapter = adapter or self
self._faction_list = None # what are the odds this will change? could cache forever!
@property @property
def client(self): def client(self) -> SwaggerClient:
if self._client is None: if self._client is None:
self._client = esi_client_factory( self._client = esi_client_factory(
token=self._token, spec_file=SWAGGER_SPEC_PATH, app_info_text=("allianceauth v" + __version__) token=self._token,
ua_appname=__title__,
ua_version=__version__,
ua_url=__url__,
) )
return self._client return self._client
def __str__(self): def __str__(self) -> str:
return 'esi' return 'esi'
def get_alliance(self, alliance_id: int) -> Alliance: def get_alliance(self, alliance_id: int) -> Alliance:

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@ class BravadoResponseStub:
self.headers = headers if headers else {} self.headers = headers if headers else {}
self.raw_bytes = raw_bytes self.raw_bytes = raw_bytes
def __str__(self): def __str__(self) -> str:
return f"{self.status_code} {self.reason}" return f"{self.status_code} {self.reason}"

View File

@@ -676,16 +676,6 @@ class TestEveSwaggerProvider(TestCase):
self.assertTrue(mock_esi_client_factory.called) self.assertTrue(mock_esi_client_factory.called)
self.assertIsNotNone(my_provider._client) self.assertIsNotNone(my_provider._client)
@patch(MODULE_PATH + '.SWAGGER_SPEC_PATH', SWAGGER_OLD_SPEC_PATH)
@patch(MODULE_PATH + '.settings.DEBUG', False)
@patch('socket.socket')
def test_create_client_on_normal_startup_w_old_swagger_spec(
self, mock_socket
):
mock_socket.side_effect = Exception('Network blocked for testing')
my_provider = EveSwaggerProvider()
self.assertIsNone(my_provider._client)
@patch(MODULE_PATH + '.settings.DEBUG', True) @patch(MODULE_PATH + '.settings.DEBUG', True)
@patch(MODULE_PATH + '.esi_client_factory') @patch(MODULE_PATH + '.esi_client_factory')
def test_dont_create_client_on_debug_startup(self, mock_esi_client_factory): def test_dont_create_client_on_debug_startup(self, mock_esi_client_factory):
@@ -722,6 +712,6 @@ class TestEveSwaggerProvider(TestCase):
my_provider = EveSwaggerProvider() my_provider = EveSwaggerProvider()
my_client = my_provider.client my_client = my_provider.client
operation = my_client.Universe.get_universe_factions() operation = my_client.Universe.get_universe_factions()
self.assertEqual( self.assertIn(
operation.future.request.headers['User-Agent'], 'allianceauth v1.0.0 dummy@example.net' 'AllianceAuth/1.0.0 (dummy@example.net; +https://gitlab.com/allianceauth/allianceauth)', operation.future.request.headers['User-Agent']
) )

View File

@@ -13,7 +13,7 @@ class Fatlink(models.Model):
hash = models.CharField(max_length=254, unique=True) hash = models.CharField(max_length=254, unique=True)
creator = models.ForeignKey(User, on_delete=models.SET(get_sentinel_user)) creator = models.ForeignKey(User, on_delete=models.SET(get_sentinel_user))
def __str__(self): def __str__(self) -> str:
return self.fleet return self.fleet
@@ -28,5 +28,5 @@ class Fat(models.Model):
class Meta: class Meta:
unique_together = (('character', 'fatlink'),) unique_together = (('character', 'fatlink'),)
def __str__(self): def __str__(self) -> str:
return f"Fat-link for {self.character.character_name}" return f"Fat-link for {self.character.character_name}"

View File

@@ -15,7 +15,7 @@ class GroupRequest(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE)
group = models.ForeignKey(Group, on_delete=models.CASCADE) group = models.ForeignKey(Group, on_delete=models.CASCADE)
def __str__(self): def __str__(self) -> str:
return self.user.username + ":" + self.group.name return self.user.username + ":" + self.group.name
@property @property
@@ -50,7 +50,7 @@ class RequestLog(models.Model):
request_actor = models.ForeignKey(User, on_delete=models.CASCADE) request_actor = models.ForeignKey(User, on_delete=models.CASCADE)
date = models.DateTimeField(auto_now_add=True) date = models.DateTimeField(auto_now_add=True)
def __str__(self): def __str__(self) -> str:
return self.pk return self.pk
def requestor(self): def requestor(self):
@@ -179,7 +179,7 @@ class AuthGroup(models.Model):
) )
default_permissions = () default_permissions = ()
def __str__(self): def __str__(self) -> str:
return self.group.name return self.group.name
def group_request_approvers(self) -> set[User]: def group_request_approvers(self) -> set[User]:

View File

@@ -13,7 +13,7 @@ class ApplicationQuestion(models.Model):
help_text = models.CharField(max_length=254, blank=True) help_text = models.CharField(max_length=254, blank=True)
multi_select = models.BooleanField(default=False) multi_select = models.BooleanField(default=False)
def __str__(self): def __str__(self) -> str:
return "Question: " + self.title return "Question: " + self.title
@@ -21,7 +21,7 @@ class ApplicationChoice(models.Model):
question = models.ForeignKey(ApplicationQuestion,on_delete=models.CASCADE,related_name="choices") question = models.ForeignKey(ApplicationQuestion,on_delete=models.CASCADE,related_name="choices")
choice_text = models.CharField(max_length=200, verbose_name='Choice') choice_text = models.CharField(max_length=200, verbose_name='Choice')
def __str__(self): def __str__(self) -> str:
return self.choice_text return self.choice_text
@@ -29,7 +29,7 @@ class ApplicationForm(models.Model):
questions = SortedManyToManyField(ApplicationQuestion) questions = SortedManyToManyField(ApplicationQuestion)
corp = models.OneToOneField(EveCorporationInfo, on_delete=models.CASCADE) corp = models.OneToOneField(EveCorporationInfo, on_delete=models.CASCADE)
def __str__(self): def __str__(self) -> str:
return str(self.corp) return str(self.corp)
@@ -50,7 +50,7 @@ class Application(models.Model):
('view_apis', 'Can view applicant APIs'),) ('view_apis', 'Can view applicant APIs'),)
unique_together = ('form', 'user') unique_together = ('form', 'user')
def __str__(self): def __str__(self) -> str:
return str(self.user) + " Application To " + str(self.form) return str(self.user) + " Application To " + str(self.form)
@property @property
@@ -77,7 +77,7 @@ class ApplicationResponse(models.Model):
answer = models.TextField() answer = models.TextField()
class Meta: class Meta:
unique_together = ('question', 'application') unique_together = ('question', 'application')
def __str__(self): def __str__(self) -> str:
return str(self.application) + " Answer To " + str(self.question) return str(self.application) + " Answer To " + str(self.question)
@@ -89,5 +89,5 @@ class ApplicationComment(models.Model):
text = models.TextField() text = models.TextField()
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
def __str__(self): def __str__(self) -> str:
return str(self.user) + " comment on " + str(self.application) return str(self.user) + " comment on " + str(self.application)

View File

@@ -19,7 +19,7 @@ class OpTimerType(models.Model):
ordering = ['type'] ordering = ['type']
default_permissions = () default_permissions = ()
def __str__(self): def __str__(self) -> str:
return self.type return self.type
class OpTimer(models.Model): class OpTimer(models.Model):
@@ -39,5 +39,5 @@ class OpTimer(models.Model):
class Meta: class Meta:
ordering = ['start'] ordering = ['start']
default_permissions = () default_permissions = ()
def __str__(self): def __str__(self) -> str:
return self.operation_name return self.operation_name

View File

@@ -1,22 +1,22 @@
#!/usr/bin/env python #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os import os
import sys import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name}}.settings.local") def main() -> None:
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as err: except ImportError as exc:
# The above import may fail for some other reason. Ensure that the raise ImportError(
# issue is really that Django is missing to avoid masking other "Couldn't import Django. Are you sure it's installed and "
# exceptions on Python 2. "available on your PYTHONPATH environment variable? Did you "
try: "forget to activate a virtual environment?"
import django # noqa: F401 ) from exc
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from err
raise
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

View File

@@ -57,9 +57,9 @@ CELERYBEAT_SCHEDULE = {
'task': 'esi.tasks.cleanup_callbackredirect', 'task': 'esi.tasks.cleanup_callbackredirect',
'schedule': crontab(minute='0', hour='*/4'), 'schedule': crontab(minute='0', hour='*/4'),
}, },
'esi_cleanup_token': { 'esi_cleanup_token_subset': { # 1/48th * 1hr = 48Hr/2Day Refresh Cycles.
'task': 'esi.tasks.cleanup_token', 'task': 'esi.tasks.cleanup_token_subset',
'schedule': crontab(minute='0', hour='0'), 'schedule': crontab(minute="0", hour="*/1"),
}, },
'run_model_update': { 'run_model_update': {
'task': 'allianceauth.eveonline.tasks.run_model_update', 'task': 'allianceauth.eveonline.tasks.run_model_update',

View File

@@ -119,7 +119,7 @@ class ServicesHook:
""" """
return '' return ''
def __str__(self): def __str__(self) -> str:
return self.name or 'Unknown Service Module' return self.name or 'Unknown Service Module'
class Urls: class Urls:

View File

@@ -26,7 +26,7 @@ class NameFormatConfig(models.Model):
"formatter for each state for each service." "formatter for each state for each service."
) )
def __str__(self): def __str__(self) -> str:
return '{}: {}'.format( return '{}: {}'.format(
self.service_name, ', '.join([str(x) for x in self.states.all()]) self.service_name, ', '.join([str(x) for x in self.states.all()])
) )

View File

@@ -16,5 +16,5 @@ class DiscourseUser(models.Model):
("access_discourse", "Can access the Discourse service"), ("access_discourse", "Can access the Discourse service"),
) )
def __str__(self): def __str__(self) -> str:
return self.user.username return self.user.username

View File

@@ -18,7 +18,7 @@ class SrpFleetMain(models.Model):
class Meta: class Meta:
permissions = (('access_srp', 'Can access SRP module'),) permissions = (('access_srp', 'Can access SRP module'),)
def __str__(self): def __str__(self) -> str:
return self.fleet_name return self.fleet_name
@property @property
@@ -46,5 +46,5 @@ class SrpUserRequest(models.Model):
srp_ship_name = models.CharField(max_length=254, default="") srp_ship_name = models.CharField(max_length=254, default="")
post_time = models.DateTimeField(default=timezone.now) post_time = models.DateTimeField(default=timezone.now)
def __str__(self): def __str__(self) -> str:
return self.character.character_name + ' SRP request for ' + self.srp_ship_name return self.character.character_name + ' SRP request for ' + self.srp_ship_name

View File

@@ -2,7 +2,7 @@ import os
from esi.clients import EsiClientProvider from esi.clients import EsiClientProvider
from allianceauth import __version__ from allianceauth import __version__, __title__, __url__
SWAGGER_SPEC = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json') SWAGGER_SPEC = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json')
@@ -12,8 +12,8 @@ get_killmails_killmail_id_killmail_hash
get_universe_types_type_id get_universe_types_type_id
""" """
esi = EsiClientProvider( esi = EsiClientProvider(
spec_file=SWAGGER_SPEC, ua_appname=__title__,
app_info_text=("allianceauth v" + __version__) ua_version=__version__,
ua_url=__url__,
) )

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
PROTOCOL=https:// PROTOCOL=https://
AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN% AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN%
DOMAIN=%DOMAIN% DOMAIN=%DOMAIN%
AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v5.0.0a1 AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v5.0.0a3
# Nginx Proxy Manager # Nginx Proxy Manager
PROXY_HTTP_PORT=80 PROXY_HTTP_PORT=80

View File

@@ -1,5 +1,5 @@
FROM python:3.12-slim FROM python:3.12-slim
ARG AUTH_VERSION=v5.0.0a1 ARG AUTH_VERSION=v5.0.0a3
ARG AUTH_PACKAGE=allianceauth==${AUTH_VERSION} ARG AUTH_PACKAGE=allianceauth==${AUTH_VERSION}
ENV AUTH_USER=allianceauth ENV AUTH_USER=allianceauth
ENV AUTH_GROUP=allianceauth ENV AUTH_GROUP=allianceauth

View File

@@ -14,6 +14,10 @@ app = Celery('myauth')
# Celery startup if it is unavailable. # Celery startup if it is unavailable.
app.conf.broker_connection_retry_on_startup = True app.conf.broker_connection_retry_on_startup = True
# Set a hard task execution time of 5 minutes before celery will cold restart
app.conf.worker_soft_shutdown_timeout = 300
app.conf.worker_enable_soft_shutdown_on_idle = True
# Using a string here means the worker don't have to serialize # Using a string here means the worker don't have to serialize
# the configuration object to child processes. # the configuration object to child processes.
app.config_from_object('django.conf:settings') app.config_from_object('django.conf:settings')

View File

@@ -89,8 +89,8 @@ services:
container_name: allianceauth_gunicorn container_name: allianceauth_gunicorn
<<: [*allianceauth-base] <<: [*allianceauth-base]
entrypoint: ["gunicorn", "myauth.wsgi", "--bind=0.0.0.0:8000", "--workers=3", "--timeout=120", "--max-requests=500", "--max-requests-jitter=50"] entrypoint: ["gunicorn", "myauth.wsgi", "--bind=0.0.0.0:8000", "--workers=3", "--timeout=120", "--max-requests=500", "--max-requests-jitter=50"]
ports: expose:
- 8000:8000 - 8000
allianceauth_beat: allianceauth_beat:
container_name: allianceauth_worker_beat container_name: allianceauth_worker_beat

View File

@@ -67,13 +67,13 @@ sudo apt-get install gettext
Next, we need to install Python and related development tools. Next, we need to install Python and related development tools.
:::{note} :::{note}
Should your Ubuntu come with a newer version of Python we recommend to still set up 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 Should your Ubuntu come with a newer version of Python we recommend to still set up your dev environment with the oldest Python 3 version currently supported by AA (e.g., Python 3.10 at this time of writing) to ensure your apps are compatible with all current AA installations
You can 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. You can 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 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: If you install a different python version from the default, you need to adjust some commands below to install appopriate versions of those packages, for example, using Python 3.10 you might need to run the following after using the setup steps for the repository mentioned in the AskUbuntu post above:
```shell ```shell
sudo apt-get install python3.8 python3.8-dev python3.8-venv python3-setuptools python3-pip python-pip sudo apt-get install python3.10 python3.10-dev python3.10-venv python3-setuptools python3-pip python-pip
``` ```
::: :::

View File

@@ -266,14 +266,14 @@ Every Alliance Auth installation will come with a couple of special celery relat
Celery-once is a celery extension "that allows you to prevent multiple execution and queuing of celery tasks". What that means is that you can ensure that only one instance of a celery task runs at any given time. This can be useful, for example, if you do not want multiple instances of your task to talk to the same external service at the same time. Celery-once is a celery extension "that allows you to prevent multiple execution and queuing of celery tasks". What that means is that you can ensure that only one instance of a celery task runs at any given time. This can be useful, for example, if you do not want multiple instances of your task to talk to the same external service at the same time.
We use a custom backend for celery_once in Alliance Auth defined [here](https://gitlab.com/allianceauth/allianceauth/-/blob/master/allianceauth/services/tasks.py#L14) We use a custom backend for celery_once in Alliance Auth defined in [allianceauth.services.tasks](https://gitlab.com/allianceauth/allianceauth/-/blob/master/allianceauth/services/tasks.py#L14)
You can import it for use like so: You can import it for use like so:
```python ```python
from allianceauth.services.tasks import QueueOnce from allianceauth.services.tasks import QueueOnce
``` ```
An example of Alliance Auth's use within the `@sharedtask` decorator, can be seen [here](https://gitlab.com/allianceauth/allianceauth/-/blob/master/allianceauth/services/modules/discord/tasks.py#L62) in the discord module An example of Alliance Auth's use within the `@sharedtask` decorator, can be seen in [allianceauth.services.modules.discord.tasks](https://gitlab.com/allianceauth/allianceauth/-/blob/master/allianceauth/services/modules/discord/tasks.py#L62) in the discord module
You can use it like so: You can use it like so:
```python ```python

View File

@@ -17,14 +17,14 @@ This guide is currently for Ubuntu only.
The mumble server package can be retrieved from a repository, which we need to add: The mumble server package can be retrieved from a repository, which we need to add:
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo apt-add-repository ppa:mumble/release sudo apt-add-repository ppa:mumble/release
``` ```
::: :::
:::{group-tab} CentOS 7, Stream 8, Stream 9 :::{group-tab} CentOS Stream 9, 10
sudo yum install epel-release sudo yum install epel-release
sudo yum update sudo yum update
@@ -35,14 +35,14 @@ sudo yum update
Now three packages need to be installed: Now three packages need to be installed:
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo apt-get install software-properties-common mumble-server libqt5sql5-mysql sudo apt-get install software-properties-common mumble-server libqt5sql5-mysql
``` ```
::: :::
:::{group-tab} CentOS 7, Stream 8, Stream 9 :::{group-tab} CentOS Stream 9, 10
sudo yum install mumble-server sudo yum install mumble-server

View File

@@ -24,28 +24,14 @@ BROADCAST_SERVICE_NAME = "broadcast"
Openfire require a Java 8 runtime environment. Openfire require a Java 8 runtime environment.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo apt-get install openjdk-11-jre sudo apt-get install openjdk-11-jre
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
```shell
sudo yum install java-11-openjdk java-11-openjdk-devel
```
:::
:::{group-tab} CentOS Stream 8
```shell
sudo dnf install java-11-openjdk java-11-openjdk-devel
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
sudo dnf install java-11-openjdk java-11-openjdk-devel sudo dnf install java-11-openjdk java-11-openjdk-devel
@@ -73,18 +59,10 @@ cd ~
Download and install the package, replacing the URL with the latest you got from the Openfire download page earlier Download and install the package, replacing the URL with the latest you got from the Openfire download page earlier
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204 :::{group-tab} Ubuntu 2204, 2404
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
wget <https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_4.7.2_all.deb>
dpkg -i openfire_4.7.2_all.deb
:::
:::{group-tab} CentOS Stream 8
wget <https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire-4.7.2-1.noarch.rpm>
yum install -y openfire-4.7.2-1.noarch.rpm
:::
:::{group-tab} CentOS Stream 9
wget <https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire-4.7.2-1.noarch.rpm> wget <https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire-4.7.2-1.noarch.rpm>
yum install -y openfire-4.7.2-1.noarch.rpm yum install -y openfire-4.7.2-1.noarch.rpm
::: :::

View File

@@ -17,7 +17,7 @@ If at any point `docker compose` does not work, but `docker-compose` does, you h
1. run `bash <(curl -s https://gitlab.com/allianceauth/allianceauth/-/raw/master/docker/scripts/download.sh)`. This will download all the files you need to install Alliance Auth and place them in a directory named `aa-docker`. Feel free to rename/move this folder. 1. run `bash <(curl -s https://gitlab.com/allianceauth/allianceauth/-/raw/master/docker/scripts/download.sh)`. This will download all the files you need to install Alliance Auth and place them in a directory named `aa-docker`. Feel free to rename/move this folder.
1. run `./scripts/prepare-env.sh` to set up your environment 1. run `./scripts/prepare-env.sh` to set up your environment
1. (optional) Change `PROTOCOL` to `http://` if not using SSL in `.env` 1. (optional) Change `PROTOCOL` to `http://` if not using SSL in `.env`
1. run `docker compose --env-file=.env up -d` (NOTE: if this command hangs, follow the instructions [here](https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged)) 1. run `docker compose --env-file=.env up -d` (NOTE: if this command hangs, follow the instructions on [How to Setup Entropy](https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged))
1. run `docker compose exec allianceauth_gunicorn bash` to open up a terminal inside an auth container 1. run `docker compose exec allianceauth_gunicorn bash` to open up a terminal inside an auth container
1. run `auth migrate` 1. run `auth migrate`
1. run `auth collectstatic` 1. run `auth collectstatic`

View File

@@ -14,11 +14,10 @@ Alliance Auth can be installed on any in-support *nix operating system.
Our install documentation targets the following operating systems. Our install documentation targets the following operating systems.
- Ubuntu 20.04 - Not Recommended for new installs - Ubuntu 22.04 (New installs please use 2404)
- Ubuntu 22.04 - Ubutnu 24.04
- Centos 7
- CentOS Stream 8
- CentOS Stream 9 - CentOS Stream 9
- CentOS Stream 10
To install on your favorite flavour of Linux, identify and install equivalent packages to the ones listed here. To install on your favorite flavour of Linux, identify and install equivalent packages to the ones listed here.
@@ -27,7 +26,7 @@ To install on your favorite flavour of Linux, identify and install equivalent pa
It is recommended to ensure your OS is fully up-to-date before proceeding. We may also add Package Repositories here, used later in the documentation. It is recommended to ensure your OS is fully up-to-date before proceeding. We may also add Package Repositories here, used later in the documentation.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo apt-get update sudo apt-get update
@@ -36,24 +35,7 @@ sudo do-dist-upgrade
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
```shell
yum install epel-release
sudo yum upgrade
```
:::
:::{group-tab} CentOS Stream 8
```shell
sudo dnf config-manager --set-enabled powertools
sudo dnf install epel-release epel-next-release
sudo yum upgrade
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
sudo dnf config-manager --set-enabled crb sudo dnf config-manager --set-enabled crb
@@ -66,58 +48,33 @@ sudo yum upgrade
### Python ### Python
Install Python 3.11 and related tools on your system. Install Python 3.12 and related tools on your system.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2204
:::{group-tab} Ubuntu 2004, 2204, 2404
```shell ```shell
sudo add-apt-repository ppa:deadsnakes/ppa sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update sudo apt-get update
sudo apt-get install python3.11 python3.11-dev python3.11-venv sudo apt-get install python3.12 python3.12-dev python3.12-venv
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} Ubuntu 2404
We need to build Python from source
```bash ```shell
cd ~ sudo add-apt-repository ppa:deadsnakes/ppa
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget sudo apt-get update
wget https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz sudo apt-get install python3.12 python3.12-dev python3.12-venv
tar xvf Python-3.11.7.tgz
cd Python-3.11.7/
./configure --enable-optimizations --enable-shared
sudo make altinstall
``` ```
::: :::
:::{group-tab} CentOS Stream 8 :::{group-tab} CentOS Stream 9, 10
We need to build Python from source
```bash ```bash
cd ~ sudo dnf update
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget sudo dnf install python3.12 python3.12-dev python3.12-venv
wget https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz
tar xvf Python-3.11.7.tgz
cd Python-3.11.7/
./configure --enable-optimizations --enable-shared
sudo make altinstall
```
:::
:::{group-tab} CentOS Stream 9
We need to build Python from source
```bash
cd ~
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget
wget https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz
tar xvf Python-3.11.7.tgz
cd Python-3.11.7/
./configure --enable-optimizations --enable-shared
sudo make altinstall
``` ```
::: :::
@@ -128,32 +85,24 @@ sudo make altinstall
It's recommended to use a database service instead of SQLite. Many options are available, but this guide will use MariaDB 10.11 It's recommended to use a database service instead of SQLite. Many options are available, but this guide will use MariaDB 10.11
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204
Follow the instructions at <https://mariadb.org/download/?t=repo-config&d=20.04+%22focal%22&v=10.11&r_m=osuosl> to add the MariaDB repository to your host. Follow the instructions at <https://mariadb.org/download/?t=repo-config&d=22.04+%22noble%22&v=11.4> to add the MariaDB repository to your host.
```shell ```shell
sudo apt-get install mariadb-server mariadb-client libmysqlclient-dev sudo apt-get install mariadb-server mariadb-client libmysqlclient-dev
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} Ubuntu 2404
Follow the instructions at <https://mariadb.org/download/?t=repo-config&d=CentOS+7&v=10.11&r_m=osuosl> to add the MariaDB repository to your host. Follow the instructions at <https://mariadb.org/download/?t=repo-config&d=24.04+%22noble%22&v=11.4> to add the MariaDB repository to your host.
```shell ```shell
sudo yum install MariaDB-server MariaDB-client MariaDB-devel MariaDB-shared sudo apt-get install mariadb-server mariadb-client libmysqlclient-dev
``` ```
::: :::
:::{group-tab} CentOS Stream 8 :::{group-tab} CentOS Stream 9, 10
Follow the instructions at <https://mariadb.org/download/?t=repo-config&d=CentOS+Stream&v=10.11&r_m=osuosl> to add the MariaDB repository to your host. Follow the instructions at <https://mariadb.org/download/?t=repo-config&d=CentOS+Stream&v=11.4> to add the MariaDB repository to your host.
```shell
sudo dnf install mariadb mariadb-server mariadb-devel
```
:::
:::{group-tab} CentOS Stream 9
Follow the instructions at <https://mariadb.org/download/?t=repo-config&d=CentOS+Stream&v=10.11&r_m=osuosl> to add the MariaDB repository to your host.
```shell ```shell
sudo dnf install mariadb mariadb-server mariadb-devel sudo dnf install mariadb mariadb-server mariadb-devel
@@ -164,16 +113,10 @@ sudo dnf install mariadb mariadb-server mariadb-devel
:::::{important} :::::{important}
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
If you don't plan on running the database on the same server as auth you still need to install the `libmysqlclient-dev` package If you don't plan on running the database on the same server as auth you still need to install the `libmysqlclient-dev` package
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
If you don't plan on running the database on the same server as auth you still need to install the `mariadb-devel` package
:::
:::{group-tab} CentOS Stream 8
If you don't plan on running the database on the same server as auth you still need to install the `mariadb-devel` package
:::
:::{group-tab} CentOS Stream 9
If you don't plan on running the database on the same server as auth you still need to install the `mariadb-devel` package If you don't plan on running the database on the same server as auth you still need to install the `mariadb-devel` package
::: :::
:::: ::::
@@ -185,9 +128,10 @@ A few extra utilities are also required for the installation of packages.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo apt-get install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
@@ -195,32 +139,13 @@ sudo apt-get update
sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev build-essential pkg-config sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev build-essential pkg-config
``` ```
:::
:::{group-tab} CentOS 7
```shell ```shell
sudo yum install gcc gcc-c++ unzip git redis curl bzip2-devel openssl-devel libffi-devel wget pkg-config sudo systemctl enable redis-server
``` sudo systemctl start redis-server
```shell
sudo systemctl enable redis.service
sudo systemctl start redis.service
``` ```
::: :::
:::{group-tab} CentOS Stream 8 :::{group-tab} CentOS Stream 9, 10
```shell
sudo dnf install gcc gcc-c++ unzip git redis curl bzip2-devel openssl-devel libffi-devel wget
```
```shell
sudo systemctl enable redis.service
sudo systemctl start redis.service
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
sudo dnf install gcc gcc-c++ unzip git redis curl bzip2-devel openssl-devel libffi-devel wget sudo dnf install gcc gcc-c++ unzip git redis curl bzip2-devel openssl-devel libffi-devel wget
@@ -282,28 +207,15 @@ mysql_secure_installation
For security and permissions, it's highly recommended you create a separate user to install auth under. Do not log in as this account. For security and permissions, it's highly recommended you create a separate user to install auth under. Do not log in as this account.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo adduser --disabled-login allianceserver --shell /bin/bash sudo adduser --disabled-login allianceserver --shell /bin/bash
``` ```
::: :::
:::{group-tab} CentOS 7
```shell :::{group-tab} CentOS Stream 9, 10
sudo passwd -l allianceserver
```
:::
:::{group-tab} CentOS Stream 8
```shell
sudo passwd -l allianceserver
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
sudo passwd -l allianceserver sudo passwd -l allianceserver
@@ -354,7 +266,7 @@ Your python3.x command/version may vary depending on your installed python versi
::: :::
```shell ```shell
python3.11 -m venv /home/allianceserver/venv/auth/ python3.12 -m venv /home/allianceserver/venv/auth/
``` ```
:::{tip} :::{tip}
@@ -497,44 +409,14 @@ exit
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo apt-get install supervisor sudo apt-get install supervisor
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
```shell
sudo dnf install supervisor
```
```shell
sudo systemctl enable supervisord.service
```
```shell
sudo systemctl start supervisord.service
```
:::
:::{group-tab} CentOS Stream 8
```shell
sudo dnf install supervisor
```
```shell
sudo systemctl enable supervisord.service
```
```shell
sudo systemctl start supervisord.service
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
sudo dnf install supervisor sudo dnf install supervisor
@@ -554,28 +436,14 @@ sudo systemctl start supervisord.service
Once installed, it needs a configuration file to know which processes to watch. Your Alliance Auth project comes with a ready-to-use template which will ensure the Celery workers, Celery task scheduler and Gunicorn are all running. Once installed, it needs a configuration file to know which processes to watch. Your Alliance Auth project comes with a ready-to-use template which will ensure the Celery workers, Celery task scheduler and Gunicorn are all running.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisor/conf.d/myauth.conf ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisor/conf.d/myauth.conf
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
```shell
sudo ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisord.d/myauth.ini
```
:::
:::{group-tab} CentOS Stream 8
```shell
sudo ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisord.d/myauth.ini
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
sudo ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisord.d/myauth.ini sudo ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisord.d/myauth.ini

View File

@@ -10,28 +10,14 @@ If you're using a small VPS to host services with very limited memory, consider
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
apt-get install apache2 apt-get install apache2
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
```shell
yum install httpd
```
:::
:::{group-tab} CentOS Stream 8
```shell
dnf install httpd
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
systemctl enable httpd systemctl enable httpd
@@ -41,8 +27,6 @@ systemctl start httpd
::: :::
:::: ::::
CentOS 7, Stream 8, Stream 9
## Configuration ## Configuration
### Permissions ### Permissions
@@ -50,28 +34,14 @@ CentOS 7, Stream 8, Stream 9
Apache needs to be able to read the folder containing your auth project's static files. Apache needs to be able to read the folder containing your auth project's static files.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
chown -R www-data:www-data /var/www/myauth/static chown -R www-data:www-data /var/www/myauth/static
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
```shell
chown -R apache:apache /var/www/myauth/static
```
:::
:::{group-tab} CentOS Stream 8
```shell
chown -R apache:apache /var/www/myauth/static
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
chown -R apache:apache /var/www/myauth/static chown -R apache:apache /var/www/myauth/static
@@ -87,7 +57,7 @@ Apache serves sites through defined virtual hosts. These are located in `/etc/ap
A virtual host for auth needs only proxy requests to your WSGI server (Gunicorn if you followed the installation guide) and serve static files. Examples can be found below. Create your config in its own file e.g. `myauth.conf` A virtual host for auth needs only proxy requests to your WSGI server (Gunicorn if you followed the installation guide) and serve static files. Examples can be found below. Create your config in its own file e.g. `myauth.conf`
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
To proxy and modify headers a few mods need to be enabled. To proxy and modify headers a few mods need to be enabled.
```shell ```shell
@@ -98,13 +68,7 @@ a2enmod headers
Create a new config file for auth e.g. `/etc/apache2/sites-available/myauth.conf` and fill out the virtual host configuration. To enable your config use `a2ensite myauth.conf` and then reload apache with `service apache2 reload`. Create a new config file for auth e.g. `/etc/apache2/sites-available/myauth.conf` and fill out the virtual host configuration. To enable your config use `a2ensite myauth.conf` and then reload apache with `service apache2 reload`.
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
Place your virtual host configuration in the appropriate section within `/etc/httpd/conf.d/httpd.conf` and restart the httpd service with `systemctl restart httpd`.
:::
:::{group-tab} CentOS Stream 8
Place your virtual host configuration in the appropriate section within `/etc/httpd/conf.d/httpd.conf` and restart the httpd service with `systemctl restart httpd`.
:::
:::{group-tab} CentOS Stream 9
Place your virtual host configuration in the appropriate section within `/etc/httpd/conf.d/httpd.conf` and restart the httpd service with `systemctl restart httpd`. Place your virtual host configuration in the appropriate section within `/etc/httpd/conf.d/httpd.conf` and restart the httpd service with `systemctl restart httpd`.
::: :::
:::: ::::

View File

@@ -69,7 +69,7 @@ Whatever you decide to use, remember it because we'll need it when configuring y
##### Number of workers ##### Number of workers
By default, Gunicorn will spawn only one worker. The number you set this to will depend on your own server environment, how many visitors you have etc. Gunicorn suggests `(2 x $num_cores) + 1` for the number of workers. So, for example, if you have 2 cores, you want 2 x 2 + 1 = 5 workers. See [here](https://docs.gunicorn.org/en/stable/design.html#how-many-workers) for the official discussion on this topic. By default, Gunicorn will spawn only one worker. The number you set this to will depend on your own server environment, how many visitors you have etc. Gunicorn suggests `(2 x $num_cores) + 1` for the number of workers. So, for example, if you have 2 cores, you want 2 x 2 + 1 = 5 workers. See [How Mnay Workers](https://docs.gunicorn.org/en/stable/design.html#how-many-workers) for the official discussion on this topic.
Change it by adding `--workers=5` to the command. Change it by adding `--workers=5` to the command.

View File

@@ -42,28 +42,14 @@ You will need to have [Gunicorn](gunicorn.md) or some other WSGI server setup fo
## Install ## Install
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo apt-get install nginx sudo apt-get install nginx
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} CentOS Stream 9, 10
```shell
sudo yum install nginx
```
:::
:::{group-tab} CentOS Stream 8
```shell
sudo dnf install nginx
```
:::
:::{group-tab} CentOS Stream 9
```shell ```shell
sudo dnf install nginx sudo dnf install nginx

View File

@@ -14,62 +14,29 @@ To run AA with a newer Python 3 version than your system's default, you need to
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. 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.
:::{note}
Ubuntu 2204 ships with Python 3.10 already
:::
Centos Stream 8/9:
:::{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.11, and you may need to substitute as necessary
sudo dnf install python39 python39-devel
:::
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2004, 2204, 2404 :::{group-tab} Ubuntu 2204, 2404
```shell ```shell
sudo add-apt-repository ppa:deadsnakes/ppa sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update sudo apt-get update
sudo apt-get install python3.11 python3.11-dev python3.11-venv sudo apt-get install python3.12 python3.12-dev python3.12-venv
``` ```
::: :::
:::{group-tab} CentOS 7 :::{group-tab} Ubuntu 2404
```bash ```shell
cd ~ sudo apt-get update
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget sudo apt-get install python3.12 python3.12-dev python3.12-venv
wget https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz
tar xvf Python-3.11.7.tgz
cd Python-3.11.7/
./configure --enable-optimizations --enable-shared
sudo make altinstall
``` ```
::: :::
:::{group-tab} CentOS Stream 8 :::{group-tab} CentOS Stream 9, 10
```bash ```bash
cd ~ sudo dnf update
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget sudo dnf install python3.12 python3.12-dev python3.12-venv
wget https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz
tar xvf Python-3.11.7.tgz
cd Python-3.11.7/
./configure --enable-optimizations --enable-shared
sudo make altinstall
```
:::
:::{group-tab} CentOS Stream 9
```bash
cd ~
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget
wget https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz
tar xvf Python-3.11.7.tgz
cd Python-3.11.7/
./configure --enable-optimizations --enable-shared
sudo make altinstall
``` ```
::: :::
@@ -201,10 +168,10 @@ mv /home/allianceserver/venv/auth /home/allianceserver/venv/auth_old
## Create your new venv ## Create your new venv
Now let's create our new venv with Python 3.11 and activate it: Now let's create our new venv with Python 3.12 and activate it:
```shell ```shell
python3.11 -m venv /home/allianceserver/venv/auth python3.12 -m venv /home/allianceserver/venv/auth
``` ```
```shell ```shell

View File

@@ -6,7 +6,7 @@
The default installation will have 3 workers configured for Gunicorn. This will be fine on most systems, but if your system as more than one core than you might want to increase the number of workers to get better response times. Note that more workers will also need more RAM though. The default installation will have 3 workers configured for Gunicorn. This will be fine on most systems, but if your system as more than one core than you might want to increase the number of workers to get better response times. Note that more workers will also need more RAM though.
The number you set this to will depend on your own server environment, how many visitors you have etc. Gunicorn suggests `(2 x $num_cores) + 1` for the number of workers. So for example, if you have 2 cores, you want 2 x 2 + 1 = 5 workers. See [here](https://docs.gunicorn.org/en/stable/design.html#how-many-workers) for the official discussion on this topic. The number you set this to will depend on your own server environment, how many visitors you have etc. Gunicorn suggests `(2 x $num_cores) + 1` for the number of workers. So for example, if you have 2 cores, you want 2 x 2 + 1 = 5 workers. See [How Many Workers](https://docs.gunicorn.org/en/stable/design.html#how-many-workers) for the official discussion on this topic.
::::{tabs} ::::{tabs}
:::{group-tab} Ubuntu 2204, 2404 :::{group-tab} Ubuntu 2204, 2404

View File

@@ -20,7 +20,7 @@ classifiers = [
"Environment :: Web Environment", "Environment :: Web Environment",
"Framework :: Celery", "Framework :: Celery",
"Framework :: Django", "Framework :: Django",
"Framework :: Django :: 5.1", "Framework :: Django :: 5.2",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Operating System :: POSIX :: Linux", "Operating System :: POSIX :: Linux",
@@ -40,15 +40,15 @@ dynamic = [
dependencies = [ dependencies = [
"bcrypt", "bcrypt",
"beautifulsoup4", "beautifulsoup4",
"celery>=5.4,<6", "celery>=5.5,<6",
"celery-once>=3.0.1", "celery-once>=3.0.1",
"django>=5.1,<5.2", "django>=5.2,<6",
"django-bootstrap-form", "django-bootstrap-form",
"django-bootstrap5>=23.3", "django-bootstrap5>=23.3",
"django-celery-beat>=2.7", "django-celery-beat>=2.8",
"django-esi>=5", "django-esi>=7.0.0b1",
"django-redis>=5.4", "django-redis>=5.4",
"django-registration>=5.1,<6", "django-registration>=5.2,<6",
"django-solo", "django-solo",
"django-sortedm2m", "django-sortedm2m",
"django-sri", "django-sri",
@@ -87,50 +87,6 @@ scripts.allianceauth = "allianceauth.bin.allianceauth:main"
[tool.flit.module] [tool.flit.module]
name = "allianceauth" name = "allianceauth"
[tool.ruff]
line-length = 119
format.line-ending = "lf"
lint.select = [
"B", # flake8-bugbear
"C", # pylint convention
# "D", # pydocstyle, Want to turn these on, but our docstrings are lightly used
"D300", # use triple double-quotes in docstrings PEP 257
"DJ", # flake8-django
"DOC", # pylintdoc
"E", # pycodestyle error
"F", # pyflakes (flake8 base)
"G010", # logging-warn, Warn on using logging.warn
"I", # isort
"PGH005", # pygrep-hooks, python-check-mock-method
"RUF100", # basically yesqa
"UP", # pyupgrade, will target requires-python
"W", # pycodestyle Warning
]
lint.ignore = [
"E501", # Line too long, WIP across repo.
]
lint.per-file-ignores = { "*local.py" = [ "F405", "F403" ] }
lint.isort.combine-as-imports = true # profile=django
lint.isort.section-order = [
"future",
"standard-library",
"third-party",
"DJANGO",
"ESI",
"first-party",
"local-folder",
]
lint.isort.sections."DJANGO" = [
"django",
"django_redis",
"django_registration",
]
lint.isort.sections."ESI" = [
"esi",
]
[tool.isort] [tool.isort]
profile = "django" profile = "django"
sections = [ sections = [

View File

@@ -1,21 +1,23 @@
#!/usr/bin/env python #!/usr/bin/env python
"""
Django's command-line utility for administrative tasks.
Modified to insert Tests as the first argument
"""
import sys import sys
if __name__ == "__main__":
def main() -> None:
"""Run tests"""
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as err: except ImportError as exc:
# The above import may fail for some other reason. Ensure that the raise ImportError(
# issue is really that Django is missing to avoid masking other "Couldn't import Django. Are you sure it's installed and "
# exceptions on Python 2. "available on your PYTHONPATH environment variable? Did you "
try: "forget to activate a virtual environment?"
import django # noqa: F401 ) from exc
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from err # Provide context for the original error
raise # Re-raise original exception with context
execute_from_command_line(sys.argv.insert(1, "test")) execute_from_command_line(sys.argv.insert(1, "test"))
if __name__ == '__main__':
main()

25
tox.ini
View File

@@ -1,30 +1,33 @@
[tox] [tox]
isolated_build = true requires =
skipsdist = true tox>=4.2
env_list =
docs
py{313, 312, 311, 310}-{all, core}
no_package = true
usedevelop = true usedevelop = true
envlist = py{310,311,312,313}-{all,core}, docs
[testenv] [testenv]
setenv = base_python =
all: DJANGO_SETTINGS_MODULE = tests.settings_all
core: DJANGO_SETTINGS_MODULE = tests.settings_core
basepython =
py310: python3.10 py310: python3.10
py311: python3.11 py311: python3.11
py312: python3.12 py312: python3.12
py313: python3.13 py313: python3.13
deps= deps =
coverage coverage
install_command = pip install -e ".[test]" -U {opts} {packages} set_env =
all: DJANGO_SETTINGS_MODULE = tests.settings_all
core: DJANGO_SETTINGS_MODULE = tests.settings_core
commands = commands =
all: coverage run runtests.py -v 2 --debug-mode all: coverage run runtests.py -v 2 --debug-mode
core: coverage run runtests.py allianceauth.authentication.tests.test_app_settings -v 2 --debug-mode core: coverage run runtests.py allianceauth.authentication.tests.test_app_settings -v 2 --debug-mode
all: coverage report -m all: coverage report -m
all: coverage xml all: coverage xml
install_command = pip install -e ".[test]" -U {opts} {packages}
[testenv:docs] [testenv:docs]
description = invoke sphinx-build to build the HTML docs description = invoke sphinx-build to build the HTML docs
basepython = python3.12 base_python = python3.12
install_command = pip install -e ".[docs]" -U {opts} {packages}
commands = commands =
sphinx-build -T -E -b html -d "{toxworkdir}/docs_doctree" -D language=en docs "{toxworkdir}/docs_out" {posargs} sphinx-build -T -E -b html -d "{toxworkdir}/docs_doctree" -D language=en docs "{toxworkdir}/docs_out" {posargs}
install_command = pip install -e ".[docs]" -U {opts} {packages}