refs #407 #440 Adds new variable php fpm version to nginx template and adds installation to oglive 5.13 download

ogboot_installer
Luis Gerardo Romero Garcia 2024-07-09 13:43:55 +02:00
parent c7fbea9231
commit c5298f5322
2 changed files with 16 additions and 9 deletions

View File

@ -18,7 +18,7 @@ server {
# Bloque para manejar las solicitudes a index.php
location ~ ^/index.php(/|$) {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.2-fpm.sock; # Asegúrate de que esto sea correcto
fastcgi_pass unix:/run/php/php__PHPVERSION__-fpm.sock; # Asegúrate de que esto sea correcto
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

View File

@ -588,14 +588,19 @@ TFTP_OPTIONS="--secure"
logger.warning(f"Directory {TFTPCFGDIR} exist.")
#Descargar oglive
logger.info("Downloading oglive...")
#Temporalmente se copia desde ~/oglive
# copiar desde el montaje /mnt/srv/artefactos/ogboot/tftpboot/
subprocess.run(["cp", "-r", f"/tmp/tftpboot/ogLive-5.11.0-r20210413", f"{TFTPCFGDIR}/"])
# subprocess.run(["cp", "-r", f"/tmp/ipxe/tftpboot/ipxe", f"{TFTPCFGDIR}/"])
#Crear enlace simbólico de oglive-5.11.0-r20210413 a /var/lib/tftpboot/ogLive
subprocess.run(["ln", "-s", f"{TFTPCFGDIR}/ogLive-5.11.0-r20210413", f"{TFTPCFGDIR}/ogLive"])
#Crear enlace simbólico de /var/lib/tftpboot/ogLive a /var/lib/tftpboot/ogLive/ogclient
subprocess.run(["ln", "-s", f"{TFTPCFGDIR}/ogLive", f"{TFTPCFGDIR}/ogclient"])
iso_name = "ogLive-focal-5.13.0-27-beta-amd64-r20210706.5b4bf5f.iso"
try:
result = subprocess.run(
["sudo", "/opt/ogboot/bin/oglivecli", "download", iso_name],
check=True,
capture_output=True,
text=True
)
logger.info(f"oglivecli install output: {result.stdout}")
except subprocess.CalledProcessError as e:
logger.error(f"Failed to install ogLive client: {e.stderr}")
logger.error("Continuing with the installation...")
symlink_target = f"{INSTALL_OGBOOT_TARGET}/tftpboot"
logger.info(f"Creating symbolic link from {TFTPCFGDIR} to {symlink_target}")
if not os.path.exists(symlink_target):
@ -859,6 +864,7 @@ def setup_nginx():
try:
# Obtener la IP del servidor
ip_address_server = subprocess.check_output(["ifconfig", DEFAULTDEV]).decode().split("\n")[1].split()[1]
php_version = get_php_fpm_version()
# Leer y modificar la plantilla de configuración de nginx
template_path = os.path.join(WORKDIR, "ogboot/etc/nginxServer.conf.tmpl")
@ -866,6 +872,7 @@ def setup_nginx():
nginx_content = nginx_file.read()
nginx_content = nginx_content.replace("__SERVERIP__", ip_address_server)
nginx_content = nginx_content.replace("__PHPVERSION__", php_version)
# Ruta de destino para la configuración de nginx
nginx_output = "/etc/nginx/sites-available/ogboot.conf"