Skip to content

Commit

Permalink
Merge pull request #477 from vrk-kpa/fix_restarting_ckan
Browse files Browse the repository at this point in the history
Fix various issues with uwsgi
  • Loading branch information
Zharktas authored Aug 27, 2024
2 parents 5e4c5d1 + 8519c34 commit 325ac19
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ansible/handlers/handlers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
service: name=nginx state=restarted

- name: Restart CKAN
shell: supervisorctl restart "{{ ckan_supervisor_name }}:*"
shell: supervisorctl restart "{{ ckan_supervisor_name }}"
2 changes: 1 addition & 1 deletion ansible/roles/ckan-ui/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
shell: lessc "{{ apicatalog_path }}/less/openapi_view.less" "{{ apicatalog_ckanext_path }}/fanstatic/openapi_view.css"

- name: Restart CKAN
shell: supervisorctl restart "{{ ckan_supervisor_name }}:*"
shell: supervisorctl restart "{{ ckan_supervisor_name }}"

- name: Verify CKAN is running
uri:
Expand Down
6 changes: 5 additions & 1 deletion ansible/roles/ckan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,12 @@
group: root
mode: 0644

- name: Install uwsgitop
pip:
name: uwsgitop

- name: Update supervisor configuration
shell: supervisorctl update

- name: Start CKAN
shell: supervisorctl restart "{{ ckan_supervisor_name }}:*"
shell: supervisorctl restart "{{ ckan_supervisor_name }}"
5 changes: 0 additions & 5 deletions ansible/roles/ckan/templates/ckan-uwsgi-supervisor.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

command=/usr/lib/ckan/default/bin/uwsgi -i /etc/ckan/default/ckan-uwsgi.ini

; Start just a single worker. Increase this number if you have many or
; particularly long running background jobs.
numprocs=1
process_name=%(program_name)s-%(process_num)02d

; Log files - change this to point to the existing CKAN log files
stdout_logfile=/var/log/ckan/ckan.log
stderr_logfile=/var/log/ckan/ckan.log
Expand Down
8 changes: 4 additions & 4 deletions ansible/roles/ckan/templates/ckan-uwsgi.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ virtualenv = /usr/lib/ckan/default
module = wsgi:application
master = true
pidfile = /tmp/%n.pid
harakiri = 130
harakiri = 50
max-requests = 5000
vacuum = true
callable = application
Expand All @@ -17,7 +17,9 @@ strict = true
enable-threads = true
reload-on-rss = 2048
processes = 4
threads = 2
threads = 4
stats = /tmp/stats.sock
memory-report = true

cheaper-algo = busyness
cheaper = 1
Expand All @@ -27,8 +29,6 @@ cheaper-step = 1
# Avoid multiple interpreters (automatically created in case you need mounts)
single-interpreter = true

# Fix SIGTERM
die-on-term = true

# Enable an accept mutex for a more balanced worker load
thunder-lock = true
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/postgres/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
shell: chmod 600 /var/lib/postgresql/{{ system.postgresql.version }}/main/server.* && chown "postgres:postgres" /var/lib/postgresql/{{ system.postgresql.version }}/main/server.*

- name: Ensure CKAN is not running before making changes to the database
supervisorctl: name="{{ ckan_supervisor_name }}:" state=stopped
supervisorctl: name="{{ ckan_supervisor_name }}" state=stopped
ignore_errors: True

- name: Restart postgres
Expand Down

0 comments on commit 325ac19

Please sign in to comment.