mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-05 14:46:20 +01:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10dac36dcc | ||
|
|
0ff17de419 | ||
|
|
6ee6986174 | ||
|
|
49364e7d27 | ||
|
|
f15c4fc708 | ||
|
|
6452b082a8 | ||
|
|
daaffaeabc | ||
|
|
95608db611 | ||
|
|
523aac6a08 | ||
|
|
49a271a99f | ||
|
|
af87da876b | ||
|
|
57b3841293 | ||
|
|
b02413c30c | ||
|
|
7ba1699dc6 | ||
|
|
75d67aa1b1 | ||
|
|
876f1e48e7 | ||
|
|
c7db4f0bd3 |
@@ -24,20 +24,14 @@ exclude: |
|
||||
)
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.9.9
|
||||
hooks:
|
||||
# Run the linter, and only the linter
|
||||
- id: ruff
|
||||
|
||||
# Code Upgrades
|
||||
- repo: https://github.com/adamchainz/django-upgrade
|
||||
rev: 1.23.1
|
||||
rev: 1.25.0
|
||||
hooks:
|
||||
- id: django-upgrade
|
||||
args: [--target-version=5.1]
|
||||
|
||||
- repo: https://github.com/asottile/pyupgrade # Ruff doesnt get everything.
|
||||
rev: v3.19.1
|
||||
args: [--target-version=5.2]
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.20.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py310-plus]
|
||||
@@ -73,30 +67,31 @@ repos:
|
||||
- id: check-executables-have-shebangs
|
||||
- id: end-of-file-fixer
|
||||
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
|
||||
rev: 3.2.0
|
||||
rev: 3.2.1
|
||||
hooks:
|
||||
- id: editorconfig-checker
|
||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||
rev: v0.44.0
|
||||
rev: v0.45.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
language: node
|
||||
args:
|
||||
- --disable=MD013
|
||||
|
||||
# Infrastructure
|
||||
- repo: https://github.com/tox-dev/pyproject-fmt
|
||||
rev: v2.5.0
|
||||
rev: v2.6.0
|
||||
hooks:
|
||||
- id: pyproject-fmt
|
||||
name: pyproject.toml formatter
|
||||
description: "Format the pyproject.toml file."
|
||||
args:
|
||||
- --indent=4
|
||||
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
|
||||
rev: v0.23
|
||||
rev: v0.24.1
|
||||
hooks:
|
||||
- id: validate-pyproject
|
||||
name: Validate pyproject.toml
|
||||
description: "Validate the pyproject.toml file."
|
||||
|
||||
@@ -5,7 +5,7 @@ manage online service access.
|
||||
# This will make sure the app is always imported when
|
||||
# Django starts so that shared_task will use this app.
|
||||
|
||||
__version__ = '5.0.0a1'
|
||||
__title__ = 'Alliance Auth'
|
||||
__version__ = '5.0.0a3'
|
||||
__title__ = 'AllianceAuth'
|
||||
__url__ = 'https://gitlab.com/allianceauth/allianceauth'
|
||||
NAME = f'{__title__} v{__version__}'
|
||||
|
||||
@@ -32,7 +32,7 @@ class State(models.Model):
|
||||
class Meta:
|
||||
ordering = ['-priority']
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
|
||||
def available_to_character(self, character):
|
||||
@@ -153,7 +153,7 @@ class CharacterOwnership(models.Model):
|
||||
class Meta:
|
||||
default_permissions = ('change', 'delete')
|
||||
ordering = ['user', 'character__character_name']
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return f"{self.user}: {self.character}"
|
||||
|
||||
|
||||
@@ -166,5 +166,5 @@ class OwnershipRecord(models.Model):
|
||||
class Meta:
|
||||
ordering = ['-created']
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return f"{self.user}: {self.character} on {self.created}"
|
||||
|
||||
@@ -45,7 +45,7 @@ class CorpStats(models.Model):
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return f"{self.__class__.__name__} for {self.corp}"
|
||||
|
||||
def update(self):
|
||||
@@ -154,7 +154,7 @@ class CorpMember(models.Model):
|
||||
unique_together = ('corpstats', 'character_id')
|
||||
ordering = ['character_name']
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.character_name
|
||||
|
||||
@property
|
||||
|
||||
@@ -81,7 +81,7 @@ class AutogroupsConfig(models.Model):
|
||||
|
||||
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))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -235,7 +235,7 @@ class ManagedGroup(models.Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return f"Managed Group: {self.group.name}"
|
||||
|
||||
class ManagedCorpGroup(ManagedGroup):
|
||||
|
||||
@@ -32,7 +32,7 @@ class EveFactionInfo(models.Model):
|
||||
|
||||
provider = providers.provider
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.faction_name
|
||||
|
||||
@staticmethod
|
||||
@@ -80,7 +80,7 @@ class EveAllianceInfo(models.Model):
|
||||
|
||||
class Meta:
|
||||
indexes = [models.Index(fields=['executor_corp_id',])]
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.alliance_name
|
||||
def populate_alliance(self):
|
||||
alliance = self.provider.get_alliance(self.alliance_id)
|
||||
@@ -152,7 +152,7 @@ class EveCorporationInfo(models.Model):
|
||||
|
||||
class Meta:
|
||||
indexes = [models.Index(fields=['ceo_id',]),]
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.corporation_name
|
||||
def update_corporation(self, corp: providers.Corporation = None):
|
||||
if corp is None:
|
||||
@@ -226,7 +226,7 @@ class EveCharacter(models.Model):
|
||||
models.Index(fields=['faction_id',]),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.character_name
|
||||
|
||||
@property
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from bravado.client import SwaggerClient
|
||||
from bravado.exception import HTTPError, HTTPNotFound, HTTPUnprocessableEntity
|
||||
from jsonschema.exceptions import RefResolutionError
|
||||
|
||||
@@ -8,7 +9,7 @@ from django.conf import settings
|
||||
|
||||
from esi.clients import esi_client_factory
|
||||
|
||||
from allianceauth import __version__
|
||||
from allianceauth import __version__, __title__, __url__
|
||||
from allianceauth.utils.django import StartupCommand
|
||||
|
||||
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(
|
||||
@@ -36,7 +37,7 @@ class ObjectNotFound(Exception):
|
||||
self.id = obj_id
|
||||
self.type = type_name
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return f'{self.type} with ID {self.id} not found.'
|
||||
|
||||
|
||||
@@ -46,7 +47,7 @@ class Entity:
|
||||
self.id = id
|
||||
self.name = name
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
|
||||
def __repr__(self):
|
||||
@@ -175,7 +176,11 @@ class 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:
|
||||
self._client = None
|
||||
logger.info('ESI client will be loaded on-demand')
|
||||
@@ -183,9 +188,10 @@ class EveSwaggerProvider(EveProvider):
|
||||
logger.info('Loading ESI client')
|
||||
try:
|
||||
self._client = esi_client_factory(
|
||||
token=token,
|
||||
spec_file=SWAGGER_SPEC_PATH,
|
||||
app_info_text=f"allianceauth v{__version__}"
|
||||
token=self._token,
|
||||
ua_appname=__title__,
|
||||
ua_version=__version__,
|
||||
ua_url=__url__,
|
||||
)
|
||||
except (HTTPError, RefResolutionError):
|
||||
logger.exception(
|
||||
@@ -194,19 +200,18 @@ class EveSwaggerProvider(EveProvider):
|
||||
)
|
||||
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
|
||||
def client(self):
|
||||
def client(self) -> SwaggerClient:
|
||||
if self._client is None:
|
||||
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
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return 'esi'
|
||||
|
||||
def get_alliance(self, alliance_id: int) -> Alliance:
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ class BravadoResponseStub:
|
||||
self.headers = headers if headers else {}
|
||||
self.raw_bytes = raw_bytes
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return f"{self.status_code} {self.reason}"
|
||||
|
||||
|
||||
|
||||
@@ -676,16 +676,6 @@ class TestEveSwaggerProvider(TestCase):
|
||||
self.assertTrue(mock_esi_client_factory.called)
|
||||
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 + '.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_client = my_provider.client
|
||||
operation = my_client.Universe.get_universe_factions()
|
||||
self.assertEqual(
|
||||
operation.future.request.headers['User-Agent'], 'allianceauth v1.0.0 dummy@example.net'
|
||||
self.assertIn(
|
||||
'AllianceAuth/1.0.0 (dummy@example.net; +https://gitlab.com/allianceauth/allianceauth)', operation.future.request.headers['User-Agent']
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ class Fatlink(models.Model):
|
||||
hash = models.CharField(max_length=254, unique=True)
|
||||
creator = models.ForeignKey(User, on_delete=models.SET(get_sentinel_user))
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.fleet
|
||||
|
||||
|
||||
@@ -28,5 +28,5 @@ class Fat(models.Model):
|
||||
class Meta:
|
||||
unique_together = (('character', 'fatlink'),)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return f"Fat-link for {self.character.character_name}"
|
||||
|
||||
@@ -15,7 +15,7 @@ class GroupRequest(models.Model):
|
||||
user = models.ForeignKey(User, 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
|
||||
|
||||
@property
|
||||
@@ -50,7 +50,7 @@ class RequestLog(models.Model):
|
||||
request_actor = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
date = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.pk
|
||||
|
||||
def requestor(self):
|
||||
@@ -179,7 +179,7 @@ class AuthGroup(models.Model):
|
||||
)
|
||||
default_permissions = ()
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.group.name
|
||||
|
||||
def group_request_approvers(self) -> set[User]:
|
||||
|
||||
@@ -13,7 +13,7 @@ class ApplicationQuestion(models.Model):
|
||||
help_text = models.CharField(max_length=254, blank=True)
|
||||
multi_select = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return "Question: " + self.title
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class ApplicationChoice(models.Model):
|
||||
question = models.ForeignKey(ApplicationQuestion,on_delete=models.CASCADE,related_name="choices")
|
||||
choice_text = models.CharField(max_length=200, verbose_name='Choice')
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.choice_text
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class ApplicationForm(models.Model):
|
||||
questions = SortedManyToManyField(ApplicationQuestion)
|
||||
corp = models.OneToOneField(EveCorporationInfo, on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return str(self.corp)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class Application(models.Model):
|
||||
('view_apis', 'Can view applicant APIs'),)
|
||||
unique_together = ('form', 'user')
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return str(self.user) + " Application To " + str(self.form)
|
||||
|
||||
@property
|
||||
@@ -77,7 +77,7 @@ class ApplicationResponse(models.Model):
|
||||
answer = models.TextField()
|
||||
class Meta:
|
||||
unique_together = ('question', 'application')
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return str(self.application) + " Answer To " + str(self.question)
|
||||
|
||||
|
||||
@@ -89,5 +89,5 @@ class ApplicationComment(models.Model):
|
||||
text = models.TextField()
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return str(self.user) + " comment on " + str(self.application)
|
||||
|
||||
@@ -19,7 +19,7 @@ class OpTimerType(models.Model):
|
||||
ordering = ['type']
|
||||
default_permissions = ()
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.type
|
||||
|
||||
class OpTimer(models.Model):
|
||||
@@ -39,5 +39,5 @@ class OpTimer(models.Model):
|
||||
class Meta:
|
||||
ordering = ['start']
|
||||
default_permissions = ()
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.operation_name
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
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:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as err:
|
||||
# The above import may fail for some other reason. Ensure that the
|
||||
# issue is really that Django is missing to avoid masking other
|
||||
# exceptions on Python 2.
|
||||
try:
|
||||
import django # noqa: F401
|
||||
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
|
||||
except ImportError as exc:
|
||||
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 exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -57,9 +57,9 @@ CELERYBEAT_SCHEDULE = {
|
||||
'task': 'esi.tasks.cleanup_callbackredirect',
|
||||
'schedule': crontab(minute='0', hour='*/4'),
|
||||
},
|
||||
'esi_cleanup_token': {
|
||||
'task': 'esi.tasks.cleanup_token',
|
||||
'schedule': crontab(minute='0', hour='0'),
|
||||
'esi_cleanup_token_subset': { # 1/48th * 1hr = 48Hr/2Day Refresh Cycles.
|
||||
'task': 'esi.tasks.cleanup_token_subset',
|
||||
'schedule': crontab(minute="0", hour="*/1"),
|
||||
},
|
||||
'run_model_update': {
|
||||
'task': 'allianceauth.eveonline.tasks.run_model_update',
|
||||
|
||||
@@ -119,7 +119,7 @@ class ServicesHook:
|
||||
"""
|
||||
return ''
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.name or 'Unknown Service Module'
|
||||
|
||||
class Urls:
|
||||
|
||||
@@ -26,7 +26,7 @@ class NameFormatConfig(models.Model):
|
||||
"formatter for each state for each service."
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return '{}: {}'.format(
|
||||
self.service_name, ', '.join([str(x) for x in self.states.all()])
|
||||
)
|
||||
|
||||
@@ -16,5 +16,5 @@ class DiscourseUser(models.Model):
|
||||
("access_discourse", "Can access the Discourse service"),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.user.username
|
||||
|
||||
@@ -18,7 +18,7 @@ class SrpFleetMain(models.Model):
|
||||
class Meta:
|
||||
permissions = (('access_srp', 'Can access SRP module'),)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.fleet_name
|
||||
|
||||
@property
|
||||
@@ -46,5 +46,5 @@ class SrpUserRequest(models.Model):
|
||||
srp_ship_name = models.CharField(max_length=254, default="")
|
||||
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
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
|
||||
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')
|
||||
|
||||
@@ -12,8 +12,8 @@ get_killmails_killmail_id_killmail_hash
|
||||
get_universe_types_type_id
|
||||
"""
|
||||
|
||||
|
||||
esi = EsiClientProvider(
|
||||
spec_file=SWAGGER_SPEC,
|
||||
app_info_text=("allianceauth v" + __version__)
|
||||
ua_appname=__title__,
|
||||
ua_version=__version__,
|
||||
ua_url=__url__,
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
PROTOCOL=https://
|
||||
AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN%
|
||||
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
|
||||
PROXY_HTTP_PORT=80
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FROM python:3.12-slim
|
||||
ARG AUTH_VERSION=v5.0.0a1
|
||||
ARG AUTH_VERSION=v5.0.0a3
|
||||
ARG AUTH_PACKAGE=allianceauth==${AUTH_VERSION}
|
||||
ENV AUTH_USER=allianceauth
|
||||
ENV AUTH_GROUP=allianceauth
|
||||
|
||||
@@ -14,6 +14,10 @@ app = Celery('myauth')
|
||||
# Celery startup if it is unavailable.
|
||||
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
|
||||
# the configuration object to child processes.
|
||||
app.config_from_object('django.conf:settings')
|
||||
|
||||
@@ -89,8 +89,8 @@ services:
|
||||
container_name: allianceauth_gunicorn
|
||||
<<: [*allianceauth-base]
|
||||
entrypoint: ["gunicorn", "myauth.wsgi", "--bind=0.0.0.0:8000", "--workers=3", "--timeout=120", "--max-requests=500", "--max-requests-jitter=50"]
|
||||
ports:
|
||||
- 8000:8000
|
||||
expose:
|
||||
- 8000
|
||||
|
||||
allianceauth_beat:
|
||||
container_name: allianceauth_worker_beat
|
||||
|
||||
@@ -67,13 +67,13 @@ sudo apt-get install gettext
|
||||
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 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.
|
||||
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
@@ -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.
|
||||
|
||||
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:
|
||||
|
||||
```python
|
||||
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:
|
||||
|
||||
```python
|
||||
|
||||
@@ -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:
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
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 update
|
||||
@@ -35,14 +35,14 @@ sudo yum update
|
||||
Now three packages need to be installed:
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
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
|
||||
|
||||
|
||||
@@ -24,28 +24,14 @@ BROADCAST_SERVICE_NAME = "broadcast"
|
||||
Openfire require a Java 8 runtime environment.
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
sudo apt-get install openjdk-11-jre
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```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
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
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
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
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
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
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
|
||||
:::
|
||||
|
||||
@@ -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 `./scripts/prepare-env.sh` to set up your environment
|
||||
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 `auth migrate`
|
||||
1. run `auth collectstatic`
|
||||
|
||||
@@ -14,11 +14,10 @@ Alliance Auth can be installed on any in-support *nix operating system.
|
||||
|
||||
Our install documentation targets the following operating systems.
|
||||
|
||||
- Ubuntu 20.04 - Not Recommended for new installs
|
||||
- Ubuntu 22.04
|
||||
- Centos 7
|
||||
- CentOS Stream 8
|
||||
- Ubuntu 22.04 (New installs please use 2404)
|
||||
- Ubutnu 24.04
|
||||
- CentOS Stream 9
|
||||
- CentOS Stream 10
|
||||
|
||||
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.
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
sudo apt-get update
|
||||
@@ -36,24 +35,7 @@ sudo do-dist-upgrade
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```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
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
sudo dnf config-manager --set-enabled crb
|
||||
@@ -66,58 +48,33 @@ sudo yum upgrade
|
||||
|
||||
### Python
|
||||
|
||||
Install Python 3.11 and related tools on your system.
|
||||
Install Python 3.12 and related tools on your system.
|
||||
|
||||
::::{tabs}
|
||||
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204
|
||||
|
||||
```shell
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
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
|
||||
We need to build Python from source
|
||||
:::{group-tab} Ubuntu 2404
|
||||
|
||||
```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
|
||||
```shell
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3.12 python3.12-dev python3.12-venv
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 8
|
||||
We need to build Python from source
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```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
|
||||
```
|
||||
sudo dnf update
|
||||
sudo dnf install python3.12 python3.12-dev python3.12-venv
|
||||
|
||||
:::
|
||||
:::{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
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
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.
|
||||
:::{group-tab} Ubuntu 2204
|
||||
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
|
||||
sudo apt-get install mariadb-server mariadb-client libmysqlclient-dev
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
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.
|
||||
:::{group-tab} Ubuntu 2404
|
||||
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
|
||||
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
|
||||
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
|
||||
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.
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
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
|
||||
@@ -164,16 +113,10 @@ sudo dnf install mariadb mariadb-server mariadb-devel
|
||||
|
||||
:::::{important}
|
||||
::::{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
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
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
|
||||
:::{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
|
||||
:::
|
||||
::::
|
||||
@@ -185,9 +128,10 @@ A few extra utilities are also required for the installation of packages.
|
||||
|
||||
::::{tabs}
|
||||
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```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
|
||||
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
|
||||
@@ -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
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```shell
|
||||
sudo yum install gcc gcc-c++ unzip git redis curl bzip2-devel openssl-devel libffi-devel wget pkg-config
|
||||
```
|
||||
|
||||
```shell
|
||||
sudo systemctl enable redis.service
|
||||
sudo systemctl start redis.service
|
||||
sudo systemctl enable redis-server
|
||||
sudo systemctl start redis-server
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 8
|
||||
|
||||
```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
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
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.
|
||||
::::{tabs}
|
||||
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
sudo adduser --disabled-login allianceserver --shell /bin/bash
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```shell
|
||||
sudo passwd -l allianceserver
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 8
|
||||
|
||||
```shell
|
||||
sudo passwd -l allianceserver
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 9
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
sudo passwd -l allianceserver
|
||||
@@ -354,7 +266,7 @@ Your python3.x command/version may vary depending on your installed python versi
|
||||
:::
|
||||
|
||||
```shell
|
||||
python3.11 -m venv /home/allianceserver/venv/auth/
|
||||
python3.12 -m venv /home/allianceserver/venv/auth/
|
||||
```
|
||||
|
||||
:::{tip}
|
||||
@@ -497,44 +409,14 @@ exit
|
||||
|
||||
::::{tabs}
|
||||
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
sudo apt-get install supervisor
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```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
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
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.
|
||||
::::{tabs}
|
||||
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisor/conf.d/myauth.conf
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```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
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
sudo ln -s /home/allianceserver/myauth/supervisor.conf /etc/supervisord.d/myauth.ini
|
||||
|
||||
@@ -10,28 +10,14 @@ If you're using a small VPS to host services with very limited memory, consider
|
||||
|
||||
::::{tabs}
|
||||
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
apt-get install apache2
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```shell
|
||||
yum install httpd
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 8
|
||||
|
||||
```shell
|
||||
dnf install httpd
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 9
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
systemctl enable httpd
|
||||
@@ -41,8 +27,6 @@ systemctl start httpd
|
||||
:::
|
||||
::::
|
||||
|
||||
CentOS 7, Stream 8, Stream 9
|
||||
|
||||
## Configuration
|
||||
|
||||
### 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.
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
chown -R www-data:www-data /var/www/myauth/static
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```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
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
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`
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
To proxy and modify headers a few mods need to be enabled.
|
||||
|
||||
```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`.
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
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
|
||||
:::{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`.
|
||||
:::
|
||||
::::
|
||||
|
||||
@@ -69,7 +69,7 @@ Whatever you decide to use, remember it because we'll need it when configuring y
|
||||
|
||||
##### 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.
|
||||
|
||||
|
||||
@@ -42,28 +42,14 @@ You will need to have [Gunicorn](gunicorn.md) or some other WSGI server setup fo
|
||||
## Install
|
||||
|
||||
::::{tabs}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
sudo apt-get install nginx
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS 7
|
||||
|
||||
```shell
|
||||
sudo yum install nginx
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 8
|
||||
|
||||
```shell
|
||||
sudo dnf install nginx
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 9
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```shell
|
||||
sudo dnf install nginx
|
||||
|
||||
@@ -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.
|
||||
|
||||
:::{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}
|
||||
:::{group-tab} Ubuntu 2004, 2204, 2404
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
```shell
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
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
|
||||
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
|
||||
```shell
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3.12 python3.12-dev python3.12-venv
|
||||
```
|
||||
|
||||
:::
|
||||
:::{group-tab} CentOS Stream 8
|
||||
:::{group-tab} CentOS Stream 9, 10
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
:::
|
||||
:::{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
|
||||
sudo dnf update
|
||||
sudo dnf install python3.12 python3.12-dev python3.12-venv
|
||||
```
|
||||
|
||||
:::
|
||||
@@ -201,10 +168,10 @@ mv /home/allianceserver/venv/auth /home/allianceserver/venv/auth_old
|
||||
|
||||
## 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
|
||||
python3.11 -m venv /home/allianceserver/venv/auth
|
||||
python3.12 -m venv /home/allianceserver/venv/auth
|
||||
```
|
||||
|
||||
```shell
|
||||
|
||||
@@ -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 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}
|
||||
:::{group-tab} Ubuntu 2204, 2404
|
||||
|
||||
@@ -20,7 +20,7 @@ classifiers = [
|
||||
"Environment :: Web Environment",
|
||||
"Framework :: Celery",
|
||||
"Framework :: Django",
|
||||
"Framework :: Django :: 5.1",
|
||||
"Framework :: Django :: 5.2",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
@@ -40,15 +40,15 @@ dynamic = [
|
||||
dependencies = [
|
||||
"bcrypt",
|
||||
"beautifulsoup4",
|
||||
"celery>=5.4,<6",
|
||||
"celery>=5.5,<6",
|
||||
"celery-once>=3.0.1",
|
||||
"django>=5.1,<5.2",
|
||||
"django>=5.2,<6",
|
||||
"django-bootstrap-form",
|
||||
"django-bootstrap5>=23.3",
|
||||
"django-celery-beat>=2.7",
|
||||
"django-esi>=5",
|
||||
"django-celery-beat>=2.8",
|
||||
"django-esi>=7.0.0b1",
|
||||
"django-redis>=5.4",
|
||||
"django-registration>=5.1,<6",
|
||||
"django-registration>=5.2,<6",
|
||||
"django-solo",
|
||||
"django-sortedm2m",
|
||||
"django-sri",
|
||||
@@ -87,50 +87,6 @@ scripts.allianceauth = "allianceauth.bin.allianceauth:main"
|
||||
[tool.flit.module]
|
||||
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]
|
||||
profile = "django"
|
||||
sections = [
|
||||
|
||||
32
runtests.py
32
runtests.py
@@ -1,21 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Django's command-line utility for administrative tasks.
|
||||
Modified to insert Tests as the first argument
|
||||
"""
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
def main() -> None:
|
||||
"""Run tests"""
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as err:
|
||||
# The above import may fail for some other reason. Ensure that the
|
||||
# issue is really that Django is missing to avoid masking other
|
||||
# exceptions on Python 2.
|
||||
try:
|
||||
import django # noqa: F401
|
||||
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
|
||||
|
||||
except ImportError as exc:
|
||||
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 exc
|
||||
execute_from_command_line(sys.argv.insert(1, "test"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
25
tox.ini
25
tox.ini
@@ -1,30 +1,33 @@
|
||||
[tox]
|
||||
isolated_build = true
|
||||
skipsdist = true
|
||||
requires =
|
||||
tox>=4.2
|
||||
env_list =
|
||||
docs
|
||||
py{313, 312, 311, 310}-{all, core}
|
||||
no_package = true
|
||||
usedevelop = true
|
||||
envlist = py{310,311,312,313}-{all,core}, docs
|
||||
|
||||
[testenv]
|
||||
setenv =
|
||||
all: DJANGO_SETTINGS_MODULE = tests.settings_all
|
||||
core: DJANGO_SETTINGS_MODULE = tests.settings_core
|
||||
basepython =
|
||||
base_python =
|
||||
py310: python3.10
|
||||
py311: python3.11
|
||||
py312: python3.12
|
||||
py313: python3.13
|
||||
deps=
|
||||
deps =
|
||||
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 =
|
||||
all: coverage run runtests.py -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 xml
|
||||
install_command = pip install -e ".[test]" -U {opts} {packages}
|
||||
|
||||
[testenv:docs]
|
||||
description = invoke sphinx-build to build the HTML docs
|
||||
basepython = python3.12
|
||||
install_command = pip install -e ".[docs]" -U {opts} {packages}
|
||||
base_python = python3.12
|
||||
commands =
|
||||
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}
|
||||
|
||||
Reference in New Issue
Block a user