Add uwsgi
This commit is contained in:
		
							parent
							
								
									a1c4198a5e
								
							
						
					
					
						commit
						dd82313ec6
					
				| 
						 | 
					@ -4,13 +4,16 @@ After=network.target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Service]
 | 
					[Service]
 | 
				
			||||||
WorkingDirectory=/srv/useful_web_tools/cert_decoder/
 | 
					WorkingDirectory=/srv/useful_web_tools/cert_decoder/
 | 
				
			||||||
 | 
					User=www-data  # Recommended for production
 | 
				
			||||||
 | 
					Group=www-data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create venv and install deps if not already done
 | 
					# Virtual environment setup
 | 
				
			||||||
ExecStartPre=/bin/bash -c '[ -d ".venv" ] || python3 -m venv .venv'
 | 
					ExecStartPre=/bin/bash -c '[ -d ".venv" ] || python3 -m venv .venv'
 | 
				
			||||||
ExecStartPre=/bin/bash -c 'source .venv/bin/activate && pip install -r requirements.txt'
 | 
					ExecStartPre=/bin/bash -c 'source .venv/bin/activate && pip install -r requirements.txt'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Activate venv and run the app
 | 
					# uWSGI execution
 | 
				
			||||||
ExecStart=/bin/bash -c 'source .venv/bin/activate && python main.py --port 5001'
 | 
					ExecStart=/srv/useful_web_tools/cert_decoder/.venv/bin/uwsgi --ini uwsgi.ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Restart=always
 | 
					Restart=always
 | 
				
			||||||
Environment="PYTHONUNBUFFERED=1"
 | 
					Environment="PYTHONUNBUFFERED=1"
 | 
				
			||||||
StandardOutput=journal
 | 
					StandardOutput=journal
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,4 +7,5 @@ itsdangerous==2.2.0
 | 
				
			||||||
Jinja2==3.1.6
 | 
					Jinja2==3.1.6
 | 
				
			||||||
MarkupSafe==3.0.2
 | 
					MarkupSafe==3.0.2
 | 
				
			||||||
pycparser==2.22
 | 
					pycparser==2.22
 | 
				
			||||||
 | 
					uWSGI==2.0.29
 | 
				
			||||||
Werkzeug==3.1.3
 | 
					Werkzeug==3.1.3
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,10 @@
 | 
				
			||||||
 | 
					[uwsgi]
 | 
				
			||||||
 | 
					socket = /tmp/cert-decoder.sock
 | 
				
			||||||
 | 
					chmod-socket = 660
 | 
				
			||||||
 | 
					module = main:app
 | 
				
			||||||
 | 
					master = true
 | 
				
			||||||
 | 
					processes = 1
 | 
				
			||||||
 | 
					threads = 2
 | 
				
			||||||
 | 
					vacuum = true
 | 
				
			||||||
 | 
					die-on-term = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,3 +3,8 @@ cp cert_decoder/cert-decoder.service /lib/systemd/system/
 | 
				
			||||||
cp diff/diff-tool.service /lib/systemd/system/
 | 
					cp diff/diff-tool.service /lib/systemd/system/
 | 
				
			||||||
systemctl enable --now cert-decoder
 | 
					systemctl enable --now cert-decoder
 | 
				
			||||||
systemctl enable --now diff-tool
 | 
					systemctl enable --now diff-tool
 | 
				
			||||||
 | 
					sudo systemctl daemon-reload
 | 
				
			||||||
 | 
					sudo systemctl restart cert-decoder
 | 
				
			||||||
 | 
					sudo systemctl restart diff-tool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,13 +4,16 @@ After=network.target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Service]
 | 
					[Service]
 | 
				
			||||||
WorkingDirectory=/srv/useful_web_tools/diff/
 | 
					WorkingDirectory=/srv/useful_web_tools/diff/
 | 
				
			||||||
 | 
					User=www-data
 | 
				
			||||||
 | 
					Group=www-data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create venv and install deps if not already done
 | 
					# Virtual environment setup
 | 
				
			||||||
ExecStartPre=/bin/bash -c '[ -d ".venv" ] || python3 -m venv .venv'
 | 
					ExecStartPre=/bin/bash -c '[ -d ".venv" ] || python3 -m venv .venv'
 | 
				
			||||||
ExecStartPre=/bin/bash -c 'source .venv/bin/activate && pip install -r requirements.txt'
 | 
					ExecStartPre=/bin/bash -c 'source .venv/bin/activate && pip install -r requirements.txt'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Activate venv and run the app
 | 
					# uWSGI execution
 | 
				
			||||||
ExecStart=/bin/bash -c 'source .venv/bin/activate && python main.py --port 5002'
 | 
					ExecStart=/srv/useful_web_tools/diff/.venv/bin/uwsgi --ini uwsgi.ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Restart=always
 | 
					Restart=always
 | 
				
			||||||
Environment="PYTHONUNBUFFERED=1"
 | 
					Environment="PYTHONUNBUFFERED=1"
 | 
				
			||||||
StandardOutput=journal
 | 
					StandardOutput=journal
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,4 +11,5 @@ mccabe==0.7.0
 | 
				
			||||||
platformdirs==4.3.8
 | 
					platformdirs==4.3.8
 | 
				
			||||||
pylint==3.3.7
 | 
					pylint==3.3.7
 | 
				
			||||||
tomlkit==0.13.2
 | 
					tomlkit==0.13.2
 | 
				
			||||||
 | 
					uWSGI==2.0.29
 | 
				
			||||||
Werkzeug==3.1.3
 | 
					Werkzeug==3.1.3
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,10 @@
 | 
				
			||||||
 | 
					[uwsgi]
 | 
				
			||||||
 | 
					socket = /tmp/diff-tool.sock
 | 
				
			||||||
 | 
					chmod-socket = 660
 | 
				
			||||||
 | 
					module = main:app
 | 
				
			||||||
 | 
					master = true
 | 
				
			||||||
 | 
					processes = 1
 | 
				
			||||||
 | 
					threads = 2
 | 
				
			||||||
 | 
					vacuum = true
 | 
				
			||||||
 | 
					die-on-term = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue