Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Keel - LDH Middleware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
26
Issues
26
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liberty
host
Keel - LDH Middleware
Commits
1d41141d
Commit
1d41141d
authored
Jul 24, 2017
by
David Seaward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add celery configuration (with supervisor and django_celery_beat)
parent
774fb92f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
3 deletions
+75
-3
.gitignore
.gitignore
+1
-1
README.md
README.md
+9
-0
conf/supervisord/purist_account_monitor.conf
conf/supervisord/purist_account_monitor.conf
+24
-0
limitmonitor/tasks.py
limitmonitor/tasks.py
+6
-0
purist_account/__init__.py
purist_account/__init__.py
+3
-0
purist_account/celery.py
purist_account/celery.py
+30
-0
purist_account/settings.py
purist_account/settings.py
+1
-2
requires/requirements.txt
requires/requirements.txt
+1
-0
No files found.
.gitignore
View file @
1d41141d
# Site-specific ignores
purist_account/settings_local.py
docs/api/
*.pid
# Byte-compiled / optimized / DLL files
__pycache__/
...
...
README.md
View file @
1d41141d
...
...
@@ -19,6 +19,7 @@ Prerequisites
*
`libldap2-dev`
*
`libssl-dev`
*
`python3-dev`
*
`supervisor`
*
Additional uWSGI packages:
*
`uwsgi`
*
`uwsgi-emperor`
...
...
@@ -75,14 +76,20 @@ Setup
*
Hook up uWSGI:
*
`sudo apt install uwsgi uwsgi-emperor uwsgi-plugin-python3`
*
`cp ./conf/uwsgi_emperor_vassals/purist_account.ini /etc/uwsgi-emperor/vassals/`
*
Hook up Supervisor (supervisord):
*
`sudo apt install supervisor`
*
`cp ./conf/supervisord/purist_account_monitor.conf /etc/supervisor/conf.d/`
*
Restart services:
*
`sudo service uwsgi-emperor restart`
*
`sudo service nginx restart`
*
`sudo service supervisor restart`
*
Check logs:
*
`/var/log/uwsgi/emperor.log`
*
`/var/log/uwsgi/app/purist_account.log`
*
`/var/log/nginx/error.log`
*
`/var/log/nginx/access.log`
*
`/var/log/supervisor/supervisord.log`
*
`/var/log/purist/account/beat.log`
For more options and details see
<https://docs.djangoproject.com/en/1.11/#the-development-process>
...
...
@@ -144,3 +151,5 @@ Also includes code portions from:
(Copyright 2015 Anders Hofstee and contributors, Expat/MIT)
*
https://github.com/asyd/pyldap_orm/blob/master/pyldap_orm/controls.py
(Copyright 2016 Bruno Bonfils, Apache 2.0)
*
https://github.com/celery/celery/blob/master/extra/supervisord/celerybeat.conf
(Copyright 2009-2012, 2015-2016 Ask Solem and contributors, 2012-2014 GoPivotal, Inc, BSD 3-Clause)
conf/supervisord/purist_account_monitor.conf
0 → 100644
View file @
1d41141d
;
stored
as
/
etc
/
supervisor
/
conf
.
d
/
purist_account_monitor
.
conf
;
Copyright
2017
Purism
SPC
and
contributors
;
SPDX
-
License
-
Identifier
:
GPL
-
3
.
0
+
;
Adapted
from
extra
/
supervisord
/
celerybeat
.
conf
in
Celery
;
Copyright
2012
-
2014
GoPivotal
,
Inc
.
;
Copyright
2009
-
2012
,
2015
-
2016
Ask
Solem
and
contributors
;
https
://
github
.
com
/
celery
/
celery
/
blob
/
master
/
extra
/
supervisord
/
celerybeat
.
conf
;
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
[
program
:
purist_account_monitor
]
command
=/
opt
/
purist
/
account_virtualenv
/
bin
/
celery
beat
--
app
purist_account_monitor
--
scheduler
django_celery_beat
.
schedulers
:
DatabaseScheduler
--
loglevel
=
INFO
directory
=/
opt
/
purist
/
account_web
user
=
www
-
data
numprocs
=
1
stdout_logfile
=/
var
/
log
/
purist
/
account
/
beat
.
log
stderr_logfile
=/
var
/
log
/
purist
/
account
/
beat
.
log
autostart
=
true
autorestart
=
true
startsecs
=
10
;
if
rabbitmq
is
supervised
,
set
its
priority
higher
;
so
it
starts
first
priority
=
999
limitmonitor/tasks.py
0 → 100644
View file @
1d41141d
from
celery
import
shared_task
@
shared_task
def
debug_task
(
self
):
print
(
'Limit monitor'
)
purist_account/__init__.py
View file @
1d41141d
from
.celery
import
app
as
celery_app
__all__
=
[
'celery_app'
]
purist_account/celery.py
0 → 100644
View file @
1d41141d
# Copyright 2017 Purism SPC and contributors
# SPDX-License-Identifier: GPL-3.0+
# Original file from Celery 4.0.2 documentation
# Copyright 2009-2016 Ask Solem
# http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
# SPDX-License-Identifier: CC-BY-SA-4.0
import
os
from
celery
import
Celery
# set the default Django settings module for the 'celery' program.
os
.
environ
.
setdefault
(
'DJANGO_SETTINGS_MODULE'
,
'purist_account.settings'
)
app
=
Celery
(
'purist_account_monitor'
)
# Using a string here means the worker don't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app
.
config_from_object
(
'django.conf:settings'
,
namespace
=
'CELERY'
)
# Load task modules from all registered Django app configs.
app
.
autodiscover_tasks
()
@
app
.
task
(
bind
=
True
)
def
debug_task
(
self
):
print
(
'Request: {0!r}'
.
format
(
self
.
request
))
purist_account/settings.py
View file @
1d41141d
...
...
@@ -32,8 +32,7 @@ ALLOWED_HOSTS = config("ALLOWED_HOSTS", cast=Csv())
# REGISTRATION APPLICATION
#
# INSTALLED_APPS = ["registration_defaults", ] + INSTALLED_APPS + ["ldapregister", ]
INSTALLED_APPS
+=
[
"crispy_forms"
,
"ldapregister"
,
"limitmonitor"
,
]
INSTALLED_APPS
+=
[
"crispy_forms"
,
"django_celery_beat"
,
"ldapregister"
,
"limitmonitor"
,
]
REGISTRATION_OPEN
=
config
(
"REGISTRATION_OPEN"
,
cast
=
bool
)
...
...
requires/requirements.txt
View file @
1d41141d
...
...
@@ -2,6 +2,7 @@ Django==1.11.3
Jinja2==2.9.6
WooCommerce==1.2.1
celery==4.0.2
django-celery-beat==1.0.1
dj-database-url==0.4.2
django-auth-ldap==1.2.13
django-crispy-forms==1.6.1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment