repo copiado desde local

This commit is contained in:
Juan Burgos
2026-08-10 23:07:47 +00:00
parent b9e8465f1b
commit 260462e9c4
4 changed files with 6674 additions and 20 deletions

View File

@@ -1,31 +1,72 @@
# sprpcb # sprpcb
Sistema Plurinacional de Registro del Patrimonio Cultural Boliviano Sistema Plurinacional de Registro del Patrimonio Cultural Boliviano.
Modo de desarrollo en un servidor en modo tradicional (no contenedores). Clone este repositorio o descargue el script de instalacion de software requerido para un servidor Ubuntu.
# Nginx y Lets Encrypt con Docker Compose ### Guía rápida de instalación
para mas detalles, consulte la documentación oficial de [ArchesProject](https://arches.readthedocs.io/en/stable/installing/)
Este enfoque obtiene y renueva automáticamente los certificados TLS [Let's Encrypt](https://letsencrypt.org/) y configura el acceso HTTPS en Nginx para su dominio. ```bash
#cd ~
Hay 3 contenedores que trabajan para ello utilizando docker compose: wget https://gitea.patrimonio.org.bo/sysadmin/sprpcb/raw/branch/dev-7_6_x-nodocker/instalar_arches7.6_ubuntu.sh
source ./instalar_arches7.6_ubuntu.sh
* Nginx, genera certificados autofirmados "dummy" para obtener los certificados de Let's Encrypt python3.12 -m venv ENV
* Certbot - obtiene y renueva los certificados, espera hasta que Nginx esté listo para obtener los certificados source ENV/bin/activate
* Cron - cada día renueva los certificados, si verifica que están vencidos, arranca Cerbot para renovarlos, luego reinicia Nginx python -m pip install --upgrade pip
pip install arches==7.6.19
Para personalizar el manejo de certificados debe cambiar estos parámetros en el archivo `.env`. Por ejemplo: arches-admin startproject mi_proyecto
```properties
DOMAINS=patrimonio.org.bo
CERTBOT_EMAILS=admin@patrimonio.org.bo info@patrimonio.org.bo
CERTBOT_TEST_CERT=0
CERTBOT_RSA_KEY_SIZE=4096
``` ```
Configuration parameters: ### Configuración del idioma español
* `DOMAINS` - lista de dominios separadas por espacio para el manejo de certificados ```shell
* `CERTBOT_EMAILS` - lista de emails separada por espacios para los dominios correspondientes. Si no se especifica, el sistema trabajara con el parámetro `--register-unsafely-without-email` # Crear carpetas para los archivos de idioma
* `CERTBOT_TEST_CERT` - usa el servidor de prueba de Let's Encrypt staging (`--test-cert`) mkdir -p ~/ENV/lib/python3.12/site-packages/arches/locale/es/LC_MESSAGES
cd ~/ENV/lib/python3.12/site-packages/arches/locale/es/LC_MESSAGES
# Descargar los archivos necesarios del repositorio
wget https://gitea.patrimonio.org.bo/sysadmin/sprpcb/raw/branch/prod-7_6_x/arches/es/LC_MESSAGES/django.*
cd ~
```
Let's Encrypt tiene límites de velocidad. Por lo tanto, durante las pruebas es mejor usar un servidor de prueba configurando `CERTBOT_TEST_CERT=1` (valor predeterminado). Cuando esté listo para usar el servidor Let's Encrypt de producción,t `CERTBOT_TEST_CERT=0`. ### Crear carpetas para las extensiones adicionales
```bash
# cd ~/mi_proyecto/mi_proyecto
mkdir -p templates/views/components/plugins
mkdir -p media/js/views/components/plugins
```
### Editar o añadir los siguientes parámetros del archivo de configuración ~/mi_proyecto/mi_proyecto/settings.py
```properties
#...
PUBLIC_SERVER_ADDRESS = "http://IP_LOCAL:8000/" # IP_LOCAL es la ip del servidor
#...
ENABLE_USER_SIGNUP = False
PERMISSION_FRAMEWORK = "arches_default_deny.ArchesDefaultDenyPermissionFramework"
#...
LANGUAGE_CODE = "es"
# list of languages...
#...
LANGUAGES = [
# ('de', _('German')),
# ('en', _('English')),
# ('en-gb', _('British English')),
('es', _('Spanish')),
]
```
### Comandos finales para completar una instalación de arches en blanco
```bash
# se recomienda reiniciar el servidor y reconectar por ssh
# 1ra terminal:
source ENV/bin/activate
cd ~/mi_proyecto
python manage.py setup_db
python manage.py runserver IP_LOCAL:8000
# Conectar un segundo terminal al servidor de manera paralela
# 2da terminal:
source ENV/bin/activate
cd ~/mi_proyecto/mi_proyecto
npm run build_development
```
Finalmente, comprobar en un navegador web: http://IP_LOCAL:8000

BIN
es/LC_MESSAGES/django.mo Normal file

Binary file not shown.

6483
es/LC_MESSAGES/django.po Normal file

File diff suppressed because it is too large Load Diff

130
instalar_arches7.6_ubuntu.sh Executable file
View File

@@ -0,0 +1,130 @@
#!/usr/bin/env bash
# Para Ubuntu 22.04+
# probado en Ubuntu 22.04
# Responda con 'yes' para instalar postgres/postgis,
# node/npm, y elasticsearch.
# para automatizar la instalación completa se puede utilizar:
# yes | source ./instalar_arches7.6_ubuntu.sh
function install_postgres {
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-14 postgresql-contrib-14 -y
sudo apt-get install postgresql-14-postgis-3 -y
PGPASS=$(openssl rand -base64 14)
sudo -u postgres psql -d postgres -c "ALTER USER postgres with encrypted password '$PGPASS';"
sudo echo "*:*:*:postgres:$PGPASS" >> ~/.pgpass
sudo chmod 600 ~/.pgpass
sudo chmod 666 /etc/postgresql/14/main/postgresql.conf
sudo chmod 666 /etc/postgresql/14/main/pg_hba.conf
sudo echo "standard_conforming_strings = off" >> /etc/postgresql/14/main/postgresql.conf
sudo echo "listen_addresses = '*'" >> /etc/postgresql/14/main/postgresql.conf
sudo echo "#TYPE DATABASE USER CIDR-ADDRESS METHOD" > /etc/postgresql/14/main/pg_hba.conf
sudo echo "local all all trust" >> /etc/postgresql/14/main/pg_hba.conf
sudo echo "host all all 127.0.0.1/32 trust" >> /etc/postgresql/14/main/pg_hba.conf
sudo echo "host all all ::1/128 trust" >> /etc/postgresql/14/main/pg_hba.conf
sudo echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/14/main/pg_hba.conf
sudo chmod 664 /etc/postgresql/14/main/postgresql.conf
sudo chmod 664 /etc/postgresql/14/main/pg_hba.conf
sudo service postgresql restart
sudo -u postgres createdb -E UTF8 -T template0 --locale=en_US.utf8 template_postgis
sudo -u postgres psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis'"
sudo -u postgres psql -d template_postgis -c "CREATE EXTENSION postgis;"
sudo -u postgres psql -d template_postgis -c "CREATE EXTENSION \"uuid-ossp\";"
sudo -u postgres psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
sudo -u postgres psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"
sudo -u postgres psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
}
function install_npm {
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo NODE_MAJOR=18 >> ~/.profile
source ~/.profile
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list && sudo apt-get update
sudo apt-get update
sudo apt-get install nodejs -y
}
function install_elasticsearch {
sudo apt-get install apt-transport-https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" > /etc/apt/sources.list.d/elastic-8.x.list'
sudo apt-get update
sudo apt-get install elasticsearch
sudo /bin/systemctl enable elasticsearch.service
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
printf "y\nE1asticSearchforArche5\nE1asticSearchforArche5" | sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -i -u elastic
}
function main {
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update -y
sudo apt-get install -y make software-properties-common
#sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt-get install -y build-essential
sudo apt-get install -y libxml2-dev
sudo apt-get install -y libproj-dev
sudo apt-get install -y libjson-c-dev
sudo apt-get install -y xsltproc
sudo apt-get install -y docbook-xsl
sudo apt-get install -y docbook-mathml
sudo apt-get install -y libgdal-dev
sudo apt-get install -y libpq-dev
sudo apt-get install -y python3.12
sudo apt-get install -y python3.12-dev
sudo apt-get install -y python3.12-venv
echo -n "Quiere instalar elasticsearch? (y/N)? "
read answer
if echo "$answer" | grep -iq "^y" ;then
echo Sí, instalando Elasticsearch
install_elasticsearch
else
echo Omitiendo la instalación de Elasticsearch
fi
echo -n "Quiere instalar y configurar postgres/postgis? (y/N)? "
read answer
if echo "$answer" | grep -iq "^y" ;then
echo Sí, Instalando Postgres/PostGIS
install_postgres
else
echo Omitiendo la instalación de Postgres/PostGIS
fi
echo -n "Quiere instalar y configurar nodejs/npm (y/N)? "
read answer
if echo "$answer" | grep -iq "^y" ;then
echo Sí, instalando Node/npm
install_npm
else
echo Omitiendo la instalación de Node/npm
fi
echo "*******************************************************"
echo Pasos restantes para la implementación de archesproject
echo "*******************************************************"
echo -e "\t1. python3.12 -m venv ENV"
echo -e "\t2. source ENV/bin/activate"
echo -e "\t3. python -m pip install --upgrade pip"
echo -e "\t4. pip install arches==7.6.19"
echo -e "\t5. arches-admin startproject mi_proyecto"
echo -e "\t cd mi_proyecto"
echo -e "\t6. python manage.py setup_db"
echo -e "\t7. python manage.py runserver"
}
main