cleanup and comments
This commit is contained in:
parent
af8044f7a3
commit
ef6cff3fa0
|
@ -2,8 +2,6 @@ from pyinfra import host
|
||||||
from pyinfra.operations import apt, server, files
|
from pyinfra.operations import apt, server, files
|
||||||
from pyinfra.facts.server import LinuxName
|
from pyinfra.facts.server import LinuxName
|
||||||
|
|
||||||
#import os
|
|
||||||
|
|
||||||
files_path = "files/www/"
|
files_path = "files/www/"
|
||||||
|
|
||||||
## check on which Distribution the script is executed
|
## check on which Distribution the script is executed
|
||||||
|
@ -18,7 +16,7 @@ if host.get_fact(LinuxName) == "Debian":
|
||||||
# _sudo_user="pyinfra",
|
# _sudo_user="pyinfra",
|
||||||
)
|
)
|
||||||
|
|
||||||
## get repository for php7.3
|
## get repository for php7.3 part-1
|
||||||
apt.packages(
|
apt.packages(
|
||||||
name="get repository for php7.3 part-1",
|
name="get repository for php7.3 part-1",
|
||||||
packages=["lsb-release",
|
packages=["lsb-release",
|
||||||
|
@ -28,12 +26,14 @@ if host.get_fact(LinuxName) == "Debian":
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## create /etc/apt/source.list.d/
|
||||||
source_list_d_path = "/etc/apt/source.list.d/"
|
source_list_d_path = "/etc/apt/source.list.d/"
|
||||||
files.directory(
|
files.directory(
|
||||||
name="create /etc/apt/source.list.d/",
|
name="create /etc/apt/source.list.d/",
|
||||||
path=source_list_d_path,
|
path=source_list_d_path,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## get repository for php7.3 part-2
|
||||||
server.shell(
|
server.shell(
|
||||||
name="get repository for php7.3 part-2",
|
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",
|
commands=["wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg",
|
||||||
|
@ -48,8 +48,9 @@ if host.get_fact(LinuxName) == "Debian":
|
||||||
packages=["php7.3", "php-fpm"],
|
packages=["php7.3", "php-fpm"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## install apache2 as replacenebt for httpd.service
|
||||||
apt.packages(
|
apt.packages(
|
||||||
name="install apache2 for httpd.service",
|
name="install apache2 as replacenebt for httpd.service",
|
||||||
packages=["apache2"],
|
packages=["apache2"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -58,13 +59,11 @@ else:
|
||||||
print("www deploy.py don't support: \"" + host.get_fact(LinuxName) + "\" yet")
|
print("www deploy.py don't support: \"" + host.get_fact(LinuxName) + "\" yet")
|
||||||
exit("exit from www/deploy.py")
|
exit("exit from www/deploy.py")
|
||||||
|
|
||||||
## start the php73_fpm service
|
## start the php8.2-fpm.service service
|
||||||
#service_name = "php73_fpm"
|
#service_name = "php73_fpm"
|
||||||
service_name = "php8.2-fpm.service"
|
service_name = "php8.2-fpm.service"
|
||||||
server.service(
|
server.service(
|
||||||
# name="enable and restart php73_fpm",
|
|
||||||
name="enable and restart php8.2-fpm.service",
|
name="enable and restart php8.2-fpm.service",
|
||||||
# service="synapse",
|
|
||||||
service=service_name,
|
service=service_name,
|
||||||
enabled=True,
|
enabled=True,
|
||||||
running=True,
|
running=True,
|
||||||
|
@ -75,7 +74,6 @@ server.service(
|
||||||
## fetch element tarball
|
## fetch element tarball
|
||||||
url = "https://github.com/vector-im/element-web/releases/download/v1.11.52/element-v1.11.52.tar.gz"
|
url = "https://github.com/vector-im/element-web/releases/download/v1.11.52/element-v1.11.52.tar.gz"
|
||||||
dest = "/tmp/element.tar.gz"
|
dest = "/tmp/element.tar.gz"
|
||||||
#sha256_checksum = "sha256:1f309d7863f583fef7294aa34ae19413991fd82aebd4c5d8bc3ac72eab04f71a."
|
|
||||||
sha256_checksum = "1f309d7863f583fef7294aa34ae19413991fd82aebd4c5d8bc3ac72eab04f71a."
|
sha256_checksum = "1f309d7863f583fef7294aa34ae19413991fd82aebd4c5d8bc3ac72eab04f71a."
|
||||||
checksum_path = "files/www/element.sha256"
|
checksum_path = "files/www/element.sha256"
|
||||||
files.download(
|
files.download(
|
||||||
|
@ -84,15 +82,8 @@ files.download(
|
||||||
dest=dest,
|
dest=dest,
|
||||||
sha256sum=sha256_checksum,
|
sha256sum=sha256_checksum,
|
||||||
)
|
)
|
||||||
'''
|
|
||||||
server.shell(
|
|
||||||
name="fetch element tarball",
|
|
||||||
commands=["wget " +url +" -O " +dest,
|
|
||||||
"sha256sum --check --quiet " +checksum_path,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
## create /var/www/
|
||||||
files.directory(
|
files.directory(
|
||||||
name="create /var/www/",
|
name="create /var/www/",
|
||||||
path="/var/www/",
|
path="/var/www/",
|
||||||
|
@ -111,59 +102,37 @@ server.shell(
|
||||||
)
|
)
|
||||||
|
|
||||||
## cp -r /var/www/element-v1.11.52 /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_vers = "element-v1.11.52/"
|
||||||
element_path = "/var/www/" +element_vers
|
element_path = "/var/www/" +element_vers
|
||||||
server.shell(
|
server.shell(
|
||||||
name="cp -r " +element_path +" /var/www/element",
|
name="cp -r " +element_path +" /var/www/element",
|
||||||
commands=["cp -r " +element_path +" /var/www/element"],
|
commands=["cp -r " +element_path +" /var/www/element"],
|
||||||
)
|
)
|
||||||
#exi = os.path.exists(element_path)
|
|
||||||
#if exi == True:
|
|
||||||
'''
|
|
||||||
files.put(
|
|
||||||
name="cp -r /var/www/" +element_vers +" /var/www/element",
|
|
||||||
src=element_path,
|
|
||||||
dest="/var/www/element/",
|
|
||||||
)
|
|
||||||
'''
|
|
||||||
#else:
|
|
||||||
# print("file: \"" +element_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## copy element config.json
|
## copy element config.json
|
||||||
element_json_path = files_path +"config.json"
|
element_json_path = files_path +"config.json"
|
||||||
#exi = os.path.exists(element_path)
|
|
||||||
#if exi == True:
|
|
||||||
files.put(
|
files.put(
|
||||||
name="copy element config.json",
|
name="copy element config.json",
|
||||||
src=element_json_path,
|
src=element_json_path,
|
||||||
dest="/var/www/element/config.json",
|
dest="/var/www/element/config.json",
|
||||||
)
|
)
|
||||||
#else:
|
|
||||||
# print("file: \"" +element_json_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## copy heizhaus.jpg
|
## copy heizhaus.jpg
|
||||||
heizhaus_jpg_path = files_path +"heizhaus.jpg"
|
heizhaus_jpg_path = files_path +"heizhaus.jpg"
|
||||||
#exi = os.path.exists(heizhaus_jpg_path)
|
|
||||||
#if exi == True:
|
|
||||||
files.put(
|
files.put(
|
||||||
name="copy heizhaus.jpg",
|
name="copy heizhaus.jpg",
|
||||||
src=heizhaus_jpg_path,
|
src=heizhaus_jpg_path,
|
||||||
dest="/var/www/element/heizhaus.jpg",
|
dest="/var/www/element/heizhaus.jpg",
|
||||||
)
|
)
|
||||||
#else:
|
|
||||||
# print("file: \"" +heizhaus_jpg_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## heizhaus-logo.png
|
## heizhaus-logo.png
|
||||||
heizhaus_logo_path = files_path +"heizhaus-logo.png"
|
heizhaus_logo_path = files_path +"heizhaus-logo.png"
|
||||||
#exi = os.path.exists(heizhaus_logo_path)
|
|
||||||
#if exi == True:
|
|
||||||
files.put(
|
files.put(
|
||||||
name="heizhaus-logo.png",
|
name="heizhaus-logo.png",
|
||||||
src=heizhaus_logo_path,
|
src=heizhaus_logo_path,
|
||||||
dest="/var/www/element/heizhaus-logo.png",
|
dest="/var/www/element/heizhaus-logo.png",
|
||||||
)
|
)
|
||||||
#else:
|
|
||||||
# print("file: \"" +heizhaus_logo_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## mkdir /var/www/matrix
|
## mkdir /var/www/matrix
|
||||||
files.directory(
|
files.directory(
|
||||||
|
@ -173,57 +142,32 @@ files.directory(
|
||||||
|
|
||||||
## copy matrix/client
|
## copy matrix/client
|
||||||
matrix_client_json_path = files_path +"matrix_client.json"
|
matrix_client_json_path = files_path +"matrix_client.json"
|
||||||
#exi = os.path.exists(matrix_client_json_path)
|
|
||||||
#if exi == True:
|
|
||||||
files.put(
|
files.put(
|
||||||
name="copy matrix/client",
|
name="copy matrix/client",
|
||||||
src=matrix_client_json_path,
|
src=matrix_client_json_path,
|
||||||
dest="/var/www/matrix/client",
|
dest="/var/www/matrix/client",
|
||||||
)
|
)
|
||||||
#else:
|
|
||||||
# print("file: \"" +matrix_client_json_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## copy matrix/server
|
## copy matrix/server
|
||||||
matrix_server_json_path = files_path +"matrix_server.json"
|
matrix_server_json_path = files_path +"matrix_server.json"
|
||||||
#exi = os.path.exists(matrix_server_json_path)
|
|
||||||
#if exi == True:
|
|
||||||
files.put(
|
files.put(
|
||||||
name="copy matrix/server",
|
name="copy matrix/server",
|
||||||
src=matrix_server_json_path,
|
src=matrix_server_json_path,
|
||||||
dest="/var/www/matrix/server",
|
dest="/var/www/matrix/server",
|
||||||
)
|
)
|
||||||
#else:
|
|
||||||
# print("file: \"" +matrix_server_json_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## copy /etc/httpd.conf
|
## copy /etc/httpd.conf
|
||||||
httpd_conf_path = files_path +"httpd.conf"
|
httpd_conf_path = files_path +"httpd.conf"
|
||||||
#exi = os.path.exists(httpd_conf_path)
|
|
||||||
#if exi == True:
|
|
||||||
files.put(
|
files.put(
|
||||||
name="copy /etc/httpd.conf",
|
name="copy /etc/httpd.conf",
|
||||||
src=httpd_conf_path,
|
src=httpd_conf_path,
|
||||||
dest="/etc/httpd.conf",
|
dest="/etc/httpd.conf",
|
||||||
)
|
)
|
||||||
#else:
|
|
||||||
# print("file: \"" +httpd_conf_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## start apache2
|
## start apache2
|
||||||
|
service_name = "apache2"
|
||||||
server.service(
|
server.service(
|
||||||
name="start apache2",
|
name="start apache2",
|
||||||
service="apache2",
|
service=service_name,
|
||||||
running=True,
|
running=True,
|
||||||
)
|
)
|
||||||
'''
|
|
||||||
server.shell(
|
|
||||||
name="start apache2",
|
|
||||||
commands=["/etc/init.d/apache2 start"]
|
|
||||||
)
|
|
||||||
'''
|
|
||||||
|
|
||||||
## enable and reload httpd
|
|
||||||
server.service(
|
|
||||||
name="enable and reload httpd",
|
|
||||||
service="httpd",
|
|
||||||
enabled=True,
|
|
||||||
reloaded=True,
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in a new issue