reshuffle
This commit is contained in:
		
							parent
							
								
									f944245238
								
							
						
					
					
						commit
						fed3410ee6
					
				
					 13 changed files with 59 additions and 41 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -1,4 +1,3 @@ | ||||||
| .venv/ | .venv/ | ||||||
| __pycache__ | __pycache__ | ||||||
| thread-sphere.tar |  | ||||||
| posts.db | posts.db | ||||||
|  |  | ||||||
|  | @ -1,3 +1,6 @@ | ||||||
|  | # SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
|  | # Copyright (c) 2024 Interstellar Development | ||||||
|  | 
 | ||||||
| FROM python:alpine | FROM python:alpine | ||||||
| WORKDIR /usr/local/app | WORKDIR /usr/local/app | ||||||
| 
 | 
 | ||||||
|  | @ -10,4 +13,4 @@ RUN adduser -D app | ||||||
| RUN chown -R app:app ../app | RUN chown -R app:app ../app | ||||||
| USER app | USER app | ||||||
| 
 | 
 | ||||||
| CMD ["gunicorn","-w 2", "-b 0.0.0.0:5001", "wsgi:app"] | CMD ["gunicorn","-w 2", "-b 0.0.0.0:5000", "wsgi:app"] | ||||||
|  |  | ||||||
							
								
								
									
										16
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -1,16 +0,0 @@ | ||||||
| APP = thread-sphere |  | ||||||
| DOMAIN = threadsphere.com |  | ||||||
| 
 |  | ||||||
| build: |  | ||||||
| 	docker build -t $(APP) . |  | ||||||
| 	docker save -o $(APP).tar $(APP) |  | ||||||
| 
 |  | ||||||
| install: |  | ||||||
| 	openssl genrsa -out /etc/ssl/private/$(APP).key 2048 |  | ||||||
| 	openssl req -new -key /etc/ssl/private/$(APP).key -out /etc/ssl/certs/$(APP).csr -config openssl.cnf |  | ||||||
| 	openssl x509 -req -in /etc/ssl/certs/$(APP).csr -CA /root/ca.crt -CAkey /root/ca.key -CAcreateserial -out /etc/ssl/certs/$(APP).crt -extfile openssl.cnf -extensions req_ext -days 500 -sha256 |  | ||||||
| 	cp nginx.cnf /etc/nginx/sites-enabled/$(APP) |  | ||||||
| 	echo "\nzone \"$(DOMAIN)\" {\n    type master;\n    file \"/etc/bind/db.$(DOMAIN)\";\n};" | tee -a /etc/bind/named.conf.local |  | ||||||
| 	cp zonefile.cnf /etc/bind/db.$(DOMAIN) |  | ||||||
| 	docker load -i $(APP).tar |  | ||||||
| 	docker run -p 5001:5001 --name $(APP) --restart always -d $(APP) |  | ||||||
							
								
								
									
										0
									
								
								nginx.cnf → dist/nginx.cnf
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										0
									
								
								nginx.cnf → dist/nginx.cnf
									
										
									
									
										vendored
									
									
								
							
							
								
								
									
										0
									
								
								openssl.cnf → dist/openssl.cnf
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										0
									
								
								openssl.cnf → dist/openssl.cnf
									
										
									
									
										vendored
									
									
								
							
							
								
								
									
										6
									
								
								zonefile.cnf → dist/zonefile.cnf
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								zonefile.cnf → dist/zonefile.cnf
									
										
									
									
										vendored
									
									
								
							|  | @ -7,6 +7,6 @@ $TTL    604800 | ||||||
|                      604800 ) |                      604800 ) | ||||||
| ; | ; | ||||||
| @       IN      NS      ns.threadsphere.com. | @       IN      NS      ns.threadsphere.com. | ||||||
| ns      IN      A       192.168.1.1 | ns      IN      A       192.168.16.1 | ||||||
| @       IN      A       192.168.1.1 | @       IN      A       192.168.16.1 | ||||||
| www     IN      A       192.168.1.1 | www     IN      A       192.168.16.1 | ||||||
							
								
								
									
										28
									
								
								install.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								install.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | ||||||
|  | #!/bin/sh | ||||||
|  | 
 | ||||||
|  | # SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
|  | # Copyright (c) 2024 Interstellar Development | ||||||
|  | 
 | ||||||
|  | APP=thread-sphere | ||||||
|  | DOMAIN=threadsphere.com | ||||||
|  | PORT=5001 | ||||||
|  | DNS=" | ||||||
|  | zone \"$DOMAIN\" { | ||||||
|  |     type master; | ||||||
|  |     file \"/etc/bind/db.$DOMAIN\"; | ||||||
|  | };" | ||||||
|  | 
 | ||||||
|  | docker build -t $APP . | ||||||
|  | cd dist | ||||||
|  | openssl genrsa -out /etc/ssl/private/$APP.key 2048 | ||||||
|  | openssl req -new -key /etc/ssl/private/$APP.key -out /etc/ssl/certs/$APP.csr -config openssl.cnf | ||||||
|  | openssl x509 -req -in /etc/ssl/certs/$APP.csr -CA /root/ca.crt -CAkey /root/ca.key -CAcreateserial -out /etc/ssl/certs/$APP.crt -extfile openssl.cnf -extensions req_ext -days 500 -sha256 | ||||||
|  | cp nginx.cnf /etc/nginx/sites-enabled/$APP | ||||||
|  | grep -qF "$DNS" /etc/bind/named.conf.local | ||||||
|  | if [ $? -eq 0 ]; then | ||||||
|  |     echo "$DNS" | tee -a /etc/bind/named.conf.local | ||||||
|  | else | ||||||
|  |     echo "Entry already exists in named.conf.local" | ||||||
|  | fi | ||||||
|  | cp zonefile.cnf /etc/bind/db.$DOMAIN | ||||||
|  | docker run -p $PORT:5000 --name $APP --restart always -d $APP | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| /* | /* | ||||||
| This file is part of VM-Experiments. | SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| Licensed under the AGPL-3.0-or-later. See LICENSE for details.  | Copyright (c) 2024 Interstellar Development | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| * { | * { | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | <!DOCTYPE html> | ||||||
|  | 
 | ||||||
| <!-- | <!-- | ||||||
| This file is part of VM-Experiments. | SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| Licensed under the AGPL-3.0-or-later. See LICENSE for details.  | Copyright (c) 2024 Interstellar Development | ||||||
| --> | --> | ||||||
| 
 | 
 | ||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
| 
 | 
 | ||||||
| <head> | <head> | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | <!DOCTYPE html> | ||||||
|  | 
 | ||||||
| <!-- | <!-- | ||||||
| This file is part of VM-Experiments. | SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| Licensed under the AGPL-3.0-or-later. See LICENSE for details.  | Copyright (c) 2024 Interstellar Development | ||||||
| --> | --> | ||||||
| 
 | 
 | ||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
| 
 | 
 | ||||||
| <head> | <head> | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | <!DOCTYPE html> | ||||||
|  | 
 | ||||||
| <!-- | <!-- | ||||||
| This file is part of VM-Experiments. | SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| Licensed under the AGPL-3.0-or-later. See LICENSE for details.  | Copyright (c) 2024 Interstellar Development | ||||||
| --> | --> | ||||||
| 
 | 
 | ||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
| 
 | 
 | ||||||
| <head> | <head> | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | <!DOCTYPE html> | ||||||
|  | 
 | ||||||
| <!-- | <!-- | ||||||
| This file is part of VM-Experiments. | SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| Licensed under the AGPL-3.0-or-later. See LICENSE for details.  | Copyright (c) 2024 Interstellar Development | ||||||
| --> | --> | ||||||
| 
 | 
 | ||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
| 
 | 
 | ||||||
| <head> | <head> | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| # This file is part of VM-Experiments. | # SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| # Licensed under the AGPL-3.0-or-later. See LICENSE for details. | # Copyright (c) 2024 Interstellar Development | ||||||
| 
 | 
 | ||||||
| from flask import Flask, session, render_template, request, redirect, url_for | from flask import Flask, session, render_template, request, redirect, url_for | ||||||
| import sqlite3 | import sqlite3 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue