Merge branch 'www' into merge_try
This commit is contained in:
commit
f734cb439b
|
@ -37,7 +37,7 @@ if host.name != "@local":
|
||||||
group="pyinfra",
|
group="pyinfra",
|
||||||
mode="644",
|
mode="644",
|
||||||
# _doas=True,
|
# _doas=True,
|
||||||
# _sudo=True,
|
# _sudo=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if host.name == "ararat.0x90.space":
|
if host.name == "ararat.0x90.space":
|
||||||
|
@ -48,3 +48,6 @@ if host.name == "baixun.0x90.space":
|
||||||
|
|
||||||
if host.name == "chat.heizhaus.org":
|
if host.name == "chat.heizhaus.org":
|
||||||
local.include("matrix-synapse/deploy.py")
|
local.include("matrix-synapse/deploy.py")
|
||||||
|
|
||||||
|
if host.name == "www":
|
||||||
|
local.include("www/deploy.py")
|
||||||
|
|
35
files/www/config.json
Normal file
35
files/www/config.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"default_server_config": {
|
||||||
|
"m.homeserver": {
|
||||||
|
"server_name": "Heizhaus",
|
||||||
|
"base_url": "https://matrix.0x90.space/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"brand": "Element",
|
||||||
|
"branding": {
|
||||||
|
"welcomeBackgroundUrl": "heizhaus.jpg",
|
||||||
|
"authHeaderLogoUrl": "heizhaus-logo.png",
|
||||||
|
"authFooterLinks": [
|
||||||
|
{
|
||||||
|
"text": "Homepage",
|
||||||
|
"url": "https://heizhaus.org/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Wiki",
|
||||||
|
"url": "https://wiki.heizhaus.org/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"defaultCountryCode": "DE",
|
||||||
|
"settingDefaults": {
|
||||||
|
"UIFeature.registration": false
|
||||||
|
},
|
||||||
|
"disable_custom_urls": true,
|
||||||
|
"permalinkPrefix": "https://chat.heizhaus.org",
|
||||||
|
"showLabsSettings": true,
|
||||||
|
"roomDirectory": {
|
||||||
|
"servers": [
|
||||||
|
"chat.heizhaus.org"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
1
files/www/element.sha256
Normal file
1
files/www/element.sha256
Normal file
|
@ -0,0 +1 @@
|
||||||
|
sha256:1f309d7863f583fef7294aa34ae19413991fd82aebd4c5d8bc3ac72eab04f71a.
|
BIN
files/www/heizhaus-logo.png
Normal file
BIN
files/www/heizhaus-logo.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 2.3 KiB |
BIN
files/www/heizhaus.jpg
Normal file
BIN
files/www/heizhaus.jpg
Normal file
Binary file not shown.
After ![]() (image error) Size: 304 KiB |
49
files/www/httpd.conf
Normal file
49
files/www/httpd.conf
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
server "0x90.space" {
|
||||||
|
listen on egress port 80
|
||||||
|
log style forwarded
|
||||||
|
root "/0x90.space"
|
||||||
|
|
||||||
|
tcp { backlog 128 }
|
||||||
|
}
|
||||||
|
|
||||||
|
server "quellcode.0x90.space" {
|
||||||
|
listen on egress port 80
|
||||||
|
log style forwarded
|
||||||
|
root "/quellcode.0x90.space"
|
||||||
|
|
||||||
|
tcp { backlog 128 }
|
||||||
|
}
|
||||||
|
|
||||||
|
server "chat.0x90.space" {
|
||||||
|
listen on egress port 80
|
||||||
|
log style forwarded
|
||||||
|
root "/element"
|
||||||
|
|
||||||
|
location "/.well-known/matrix/*" {
|
||||||
|
root "/matrix"
|
||||||
|
request strip 2
|
||||||
|
default type application/json
|
||||||
|
}
|
||||||
|
|
||||||
|
tcp { backlog 128 }
|
||||||
|
}
|
||||||
|
|
||||||
|
server "chat.heizhaus.org" {
|
||||||
|
listen on egress port 80
|
||||||
|
log style forwarded
|
||||||
|
root "/element"
|
||||||
|
|
||||||
|
location "/.well-known/matrix/*" {
|
||||||
|
root "/matrix"
|
||||||
|
request strip 2
|
||||||
|
default type application/json
|
||||||
|
}
|
||||||
|
|
||||||
|
tcp { backlog 128 }
|
||||||
|
}
|
||||||
|
|
||||||
|
# for php:
|
||||||
|
# directory index "index.php"
|
||||||
|
# location match ".*%.php" {
|
||||||
|
# fastcgi socket "/run/php-fpm.sock"
|
||||||
|
# }
|
6
files/www/matrix_client.json
Normal file
6
files/www/matrix_client.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"m.homeserver": {
|
||||||
|
"base_url": "https://matrix.0x90.space/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
4
files/www/matrix_server.json
Normal file
4
files/www/matrix_server.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"m.server": "matrix.0x90.space:443"
|
||||||
|
}
|
||||||
|
|
|
@ -4,4 +4,5 @@ targets = [
|
||||||
("baixun.0x90.space", dict(ssh_port=42023)),
|
("baixun.0x90.space", dict(ssh_port=42023)),
|
||||||
# ("matrix.0x90.space", dict(ssh_port=42024)),
|
# ("matrix.0x90.space", dict(ssh_port=42024)),
|
||||||
("chat.heizhaus.org", dict(ssh_port=22, ssh_allow_agent=True, ssh_key="~/.ssh/0x90/id_ed25519")),
|
("chat.heizhaus.org", dict(ssh_port=22, ssh_allow_agent=True, ssh_key="~/.ssh/0x90/id_ed25519")),
|
||||||
|
("www", dict(ssh_port=22, ssh_allow_agent=True, ssh_key="~/.ssh/0x90/id_ed25519")),
|
||||||
]
|
]
|
||||||
|
|
173
www/deploy.py
Normal file
173
www/deploy.py
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
from pyinfra import host
|
||||||
|
from pyinfra.operations import apt, server, files
|
||||||
|
from pyinfra.facts.server import LinuxName
|
||||||
|
|
||||||
|
files_path = "files/www/"
|
||||||
|
|
||||||
|
## check on which Distribution the script is executed
|
||||||
|
if host.get_fact(LinuxName) == "Debian":
|
||||||
|
|
||||||
|
## update apt repositories
|
||||||
|
apt.update(
|
||||||
|
name="update apt repositories",
|
||||||
|
# _doas=True,
|
||||||
|
# _doas_user="pyinfra",
|
||||||
|
# _sudo=True,
|
||||||
|
# _sudo_user="pyinfra",
|
||||||
|
)
|
||||||
|
|
||||||
|
## get repository for php7.3 part-1
|
||||||
|
apt.packages(
|
||||||
|
name="get repository for php7.3 part-1",
|
||||||
|
packages=["lsb-release",
|
||||||
|
"apt-transport-https",
|
||||||
|
"ca-certificates",
|
||||||
|
"software-properties-common",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
## create /etc/apt/source.list.d/
|
||||||
|
source_list_d_path = "/etc/apt/source.list.d/"
|
||||||
|
files.directory(
|
||||||
|
name="create /etc/apt/source.list.d/",
|
||||||
|
path=source_list_d_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
## get repository for php7.3 part-2
|
||||||
|
server.shell(
|
||||||
|
name="get repository for php7.3 part-2",
|
||||||
|
commands=["wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg",
|
||||||
|
"sh -c 'echo \"deb https://packages.sury.org/php/ $(lsb_release -sc) main\" > /etc/apt/source.list.d/php.list'",
|
||||||
|
"apt update",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
## insrall php7.3
|
||||||
|
apt.packages(
|
||||||
|
name="install php7.3 and php-fpm",
|
||||||
|
packages=["php7.3", "php-fpm"],
|
||||||
|
)
|
||||||
|
|
||||||
|
## install apache2 as replacenebt for httpd.service
|
||||||
|
apt.packages(
|
||||||
|
name="install apache2 as replacenebt for httpd.service",
|
||||||
|
packages=["apache2"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# elif host.get_fact(LinuxName) == "":
|
||||||
|
else:
|
||||||
|
print("www deploy.py don't support: \"" + host.get_fact(LinuxName) + "\" yet")
|
||||||
|
exit("exit from www/deploy.py")
|
||||||
|
|
||||||
|
## start the php8.2-fpm.service service
|
||||||
|
#service_name = "php73_fpm"
|
||||||
|
service_name = "php8.2-fpm.service"
|
||||||
|
server.service(
|
||||||
|
name="enable and restart php8.2-fpm.service",
|
||||||
|
service=service_name,
|
||||||
|
enabled=True,
|
||||||
|
running=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ? when: phpinstall.changed
|
||||||
|
|
||||||
|
## fetch element tarball
|
||||||
|
url = "https://github.com/vector-im/element-web/releases/download/v1.11.52/element-v1.11.52.tar.gz"
|
||||||
|
dest = "/tmp/element.tar.gz"
|
||||||
|
sha256_checksum = "1f309d7863f583fef7294aa34ae19413991fd82aebd4c5d8bc3ac72eab04f71a."
|
||||||
|
checksum_path = "files/www/element.sha256"
|
||||||
|
files.download(
|
||||||
|
name="fetch element tarball",
|
||||||
|
src=url,
|
||||||
|
dest=dest,
|
||||||
|
sha256sum=sha256_checksum,
|
||||||
|
)
|
||||||
|
|
||||||
|
## create /var/www/
|
||||||
|
files.directory(
|
||||||
|
name="create /var/www/",
|
||||||
|
path="/var/www/",
|
||||||
|
)
|
||||||
|
|
||||||
|
## extract element tarball
|
||||||
|
server.shell(
|
||||||
|
name="extract element tarball",
|
||||||
|
commands=["tar xzf /tmp/element.tar.gz -C /var/www/"],
|
||||||
|
)
|
||||||
|
|
||||||
|
## rm -rf /var/www/element
|
||||||
|
server.shell(
|
||||||
|
name="rm -rf /var/www/element",
|
||||||
|
commands=["rm -rf /var/www/element"],
|
||||||
|
)
|
||||||
|
|
||||||
|
## cp -r /var/www/element-v1.11.52 /var/www/element
|
||||||
|
## files.put() seams not to be compatible with directorys
|
||||||
|
element_vers = "element-v1.11.52/"
|
||||||
|
element_path = "/var/www/" +element_vers
|
||||||
|
server.shell(
|
||||||
|
name="cp -r " +element_path +" /var/www/element",
|
||||||
|
commands=["cp -r " +element_path +" /var/www/element"],
|
||||||
|
)
|
||||||
|
|
||||||
|
## copy element config.json
|
||||||
|
element_json_path = files_path +"config.json"
|
||||||
|
files.put(
|
||||||
|
name="copy element config.json",
|
||||||
|
src=element_json_path,
|
||||||
|
dest="/var/www/element/config.json",
|
||||||
|
)
|
||||||
|
|
||||||
|
## copy heizhaus.jpg
|
||||||
|
heizhaus_jpg_path = files_path +"heizhaus.jpg"
|
||||||
|
files.put(
|
||||||
|
name="copy heizhaus.jpg",
|
||||||
|
src=heizhaus_jpg_path,
|
||||||
|
dest="/var/www/element/heizhaus.jpg",
|
||||||
|
)
|
||||||
|
|
||||||
|
## heizhaus-logo.png
|
||||||
|
heizhaus_logo_path = files_path +"heizhaus-logo.png"
|
||||||
|
files.put(
|
||||||
|
name="heizhaus-logo.png",
|
||||||
|
src=heizhaus_logo_path,
|
||||||
|
dest="/var/www/element/heizhaus-logo.png",
|
||||||
|
)
|
||||||
|
|
||||||
|
## mkdir /var/www/matrix
|
||||||
|
files.directory(
|
||||||
|
name="mkdir /var/www/matrix",
|
||||||
|
path="/var/www/matrix",
|
||||||
|
)
|
||||||
|
|
||||||
|
## copy matrix/client
|
||||||
|
matrix_client_json_path = files_path +"matrix_client.json"
|
||||||
|
files.put(
|
||||||
|
name="copy matrix/client",
|
||||||
|
src=matrix_client_json_path,
|
||||||
|
dest="/var/www/matrix/client",
|
||||||
|
)
|
||||||
|
|
||||||
|
## copy matrix/server
|
||||||
|
matrix_server_json_path = files_path +"matrix_server.json"
|
||||||
|
files.put(
|
||||||
|
name="copy matrix/server",
|
||||||
|
src=matrix_server_json_path,
|
||||||
|
dest="/var/www/matrix/server",
|
||||||
|
)
|
||||||
|
|
||||||
|
## copy /etc/httpd.conf
|
||||||
|
httpd_conf_path = files_path +"httpd.conf"
|
||||||
|
files.put(
|
||||||
|
name="copy /etc/httpd.conf",
|
||||||
|
src=httpd_conf_path,
|
||||||
|
dest="/etc/httpd.conf",
|
||||||
|
)
|
||||||
|
|
||||||
|
## start apache2
|
||||||
|
service_name = "apache2"
|
||||||
|
server.service(
|
||||||
|
name="start apache2",
|
||||||
|
service=service_name,
|
||||||
|
running=True,
|
||||||
|
)
|
Loading…
Reference in a new issue