reshuffle

This commit is contained in:
Patrick 2024-11-23 17:00:17 +01:00
parent f944245238
commit fed3410ee6
13 changed files with 59 additions and 41 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
.venv/
__pycache__
thread-sphere.tar
posts.db

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) 2024 Interstellar Development
FROM python:alpine
WORKDIR /usr/local/app
@ -10,4 +13,4 @@ RUN adduser -D app
RUN chown -R app:app ../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"]

View file

@ -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)

View file

View file

View file

@ -7,6 +7,6 @@ $TTL 604800
604800 )
;
@ IN NS ns.threadsphere.com.
ns IN A 192.168.1.1
@ IN A 192.168.1.1
www IN A 192.168.1.1
ns IN A 192.168.16.1
@ IN A 192.168.16.1
www IN A 192.168.16.1

28
install.sh Normal file
View 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

View file

@ -1,6 +1,6 @@
/*
This file is part of VM-Experiments.
Licensed under the AGPL-3.0-or-later. See LICENSE for details.
SPDX-License-Identifier: AGPL-3.0-or-later
Copyright (c) 2024 Interstellar Development
*/
* {

View file

@ -1,9 +1,10 @@
<!--
This file is part of VM-Experiments.
Licensed under the AGPL-3.0-or-later. See LICENSE for details.
<!DOCTYPE html>
<!--
SPDX-License-Identifier: AGPL-3.0-or-later
Copyright (c) 2024 Interstellar Development
-->
<!DOCTYPE html>
<html lang="en">
<head>

View file

@ -1,9 +1,10 @@
<!--
This file is part of VM-Experiments.
Licensed under the AGPL-3.0-or-later. See LICENSE for details.
<!DOCTYPE html>
<!--
SPDX-License-Identifier: AGPL-3.0-or-later
Copyright (c) 2024 Interstellar Development
-->
<!DOCTYPE html>
<html lang="en">
<head>

View file

@ -1,9 +1,10 @@
<!--
This file is part of VM-Experiments.
Licensed under the AGPL-3.0-or-later. See LICENSE for details.
<!DOCTYPE html>
<!--
SPDX-License-Identifier: AGPL-3.0-or-later
Copyright (c) 2024 Interstellar Development
-->
<!DOCTYPE html>
<html lang="en">
<head>

View file

@ -1,9 +1,10 @@
<!--
This file is part of VM-Experiments.
Licensed under the AGPL-3.0-or-later. See LICENSE for details.
<!DOCTYPE html>
<!--
SPDX-License-Identifier: AGPL-3.0-or-later
Copyright (c) 2024 Interstellar Development
-->
<!DOCTYPE html>
<html lang="en">
<head>

View file

@ -1,5 +1,5 @@
# This file is part of VM-Experiments.
# Licensed under the AGPL-3.0-or-later. See LICENSE for details.
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) 2024 Interstellar Development
from flask import Flask, session, render_template, request, redirect, url_for
import sqlite3