Browse Source

socketize uwsgi stuff

George Baugh 5 months ago
parent
commit
65900793c7
4 changed files with 17 additions and 6 deletions
  1. 10 3
      Readme.md
  2. 3 2
      config/tcms.ini
  3. 0 1
      tcms
  4. 4 0
      tcms-uwsgi

+ 10 - 3
Readme.md

@@ -3,6 +3,8 @@ tCMS
 
 
 A flexible perl CMS which supports multiple data models and content types
 A flexible perl CMS which supports multiple data models and content types
 
 
+tCMS is built fully around ubuntu hosts at the moment.
+
 Deployment is currently:
 Deployment is currently:
 * make -f Installer.mk depend
 * make -f Installer.mk depend
 * make -f Installer.mk install
 * make -f Installer.mk install
@@ -15,7 +17,9 @@ OR (if you want tCMS as a systemd service for the current user):
 
 
 This sets up nginx, reverse proxy and SSL certs for you.
 This sets up nginx, reverse proxy and SSL certs for you.
 You must set up the user which runs tCMS to have the primary group www-data if you want to be able to run without sudo or run as a usermode service.
 You must set up the user which runs tCMS to have the primary group www-data if you want to be able to run without sudo or run as a usermode service.
-It is strongly suggested that you chmod everything but the run/ directory to be 0700.
+It is strongly suggested that you chmod everything but the run/ directory to be 0700, particularly in a shared environment.
+
+It also sets up the mailserver and DNS for you.
 
 
 A Dockerfile and deployment scripts are provided for your convenience in building/running containers based on this:
 A Dockerfile and deployment scripts are provided for your convenience in building/running containers based on this:
 ```
 ```
@@ -26,9 +30,12 @@ A Dockerfile and deployment scripts are provided for your convenience in buildin
 # Extract configuration & local data, then spin down the server
 # Extract configuration & local data, then spin down the server
 ./docker-exfil.sh
 ./docker-exfil.sh
 ```
 ```
+There is also podman container code; see images/README.md
+
 The user guide is self-hosted; After you first login, hit the 'Manual' section in the backend.
 The user guide is self-hosted; After you first login, hit the 'Manual' section in the backend.
 
 
 Rate-Limiting is expected to be handled at the level of the webserver proxying requests to this application.
 Rate-Limiting is expected to be handled at the level of the webserver proxying requests to this application.
+See ufw/setup-rules as an example of the easy way to setup rules/limiting for all the services you need to run tCMS.
 
 
 Migration of tCMS1 sites
 Migration of tCMS1 sites
 =========================
 =========================
@@ -85,8 +92,8 @@ Supported PSGI servers
 
 
 Starman and uWSGI
 Starman and uWSGI
 
 
-In production, I would expect you to run under uWSGI, and the `tcms` command in the TLD runs this.
-Otherwise, you can run `www/server.psgi` to start starman normally.
+In production, I would expect you to run under uWSGI, and the `tcms-uwsgi` command in the TLD runs this.
+Otherwise, you can run `tcms` to start starman normally.
 
 
 Ideas to come:
 Ideas to come:
 =============
 =============

+ 3 - 2
config/tcms.ini

@@ -3,10 +3,11 @@
 
 
 master = 1
 master = 1
 processes = 20
 processes = 20
-http-socket = :5000
 plugin = psgi
 plugin = psgi
-socket = tcms.sock
+socket = run/tcms.sock
 thunder-lock = 1
 thunder-lock = 1
+safe-pidfile=run/tcms.pid
+daemonize = 1
 
 
 # Respawn workers after X requests, just in case there are subtle memory leaks
 # Respawn workers after X requests, just in case there are subtle memory leaks
 max-requests = 1024
 max-requests = 1024

+ 0 - 1
tcms

@@ -1,6 +1,5 @@
 #!/bin/bash
 #!/bin/bash
 [[ -e run/tcms.pid ]] && pkill -F run/tcms.pid
 [[ -e run/tcms.pid ]] && pkill -F run/tcms.pid
 sudo www/server.psgi --listen run/tcms.sock --group www-data --user $USER --daemonize --pid run/tcms.pid
 sudo www/server.psgi --listen run/tcms.sock --group www-data --user $USER --daemonize --pid run/tcms.pid
-#XXX Net::Server does not expect to run as a user other than that of the webserver
 sudo chmod 0770 run/tcms.sock
 sudo chmod 0770 run/tcms.sock
 echo "tCMS running as PID "`cat run/tcms.pid`
 echo "tCMS running as PID "`cat run/tcms.pid`

+ 4 - 0
tcms-uwsgi

@@ -1,3 +1,7 @@
 #!/bin/bash
 #!/bin/bash
+[[ -e run/tcms.pid ]] && pkill -F run/tcms.pid;
 export PSGI_ENGINE='uwsgi'
 export PSGI_ENGINE='uwsgi'
 uwsgi --ini config/tcms.ini
 uwsgi --ini config/tcms.ini
+sudo chown $USER:www-data run/tcms.sock
+sudo chmod 0770 run/tcms.sock
+echo "tCMS running as PID "`cat run/tcms.pid`