Gruppo Meteo/HowTo/server-centos
Versione del 28 feb 2018 alle 16:21 di PaoloPatruno (discussione | contributi)
Installazione RMAP server su centos 7
istallazione sistema operativo
TBD
/etc/selinux/config
SELINUX=disabled
/etc/tmpfiles.d/rmap.conf
d /run/wsgirmap 0755 rmap rmap - d /var/run/rmap 0755 rmap rmap - d /var/run/httpd 0755 rmap rmap -
mkdir /rmap chmod go+rx /rmap
postgresql
yum install postgresql-server postgresql-contrib yum install python-psycopg2
/var/lib/pgsql/data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only # allow postgres user to use "ident" authentication on Unix sockets local all postgres ident # allow all other users to use "md5" authentication on Unix sockets local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
/var/lib/pgsql/data/postgresql.conf
max_connections = 100 shared_buffers = 128MB work_mem = 100MB maintenance_work_mem = 200MB effective_cache_size = 1GB
mkdir /etc/systemd/system/postgresql.service.d/
/etc/systemd/system/postgresql.service.d/rmap.conf
[Service] # Location of database directory Environment=PGDATA=/rmap/pgsql/data
mkdir /rmap/pgsql/ chown postgres:postgres /rmap/pgsql/ mv /var/lib/pgsql/data /rmap/pgsql/
su - postgres initdb exit
systemctl enable postgresql.service systemctl start postgresql.service
su - postgres createuser -P -e rmapadmin createdb --owner=rmapadmin rmapadmin exit
/etc/rmap/rmap-site.cfg
[database] DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. DATABASE_NAME = 'rmapadmin' # Or path to database file if using sqlite3. DATABASE_USER = 'rmapadmin' # Not used with sqlite3. DATABASE_PASSWORD = 'rmapadmin' # Not used with sqlite3. DATABASE_HOST = 'localhost' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '5432' # Set to empty string for default. Not used with sqlite3.
rmapctrl --syncdb
su - postgres createuser -P -e rmap createdb --owner=rmap report_fixed createdb --owner=rmap report_mobile createdb --owner=rmap sample_fixed createdb --owner=rmap sample_mobile
exit
apache
yum install mod_wsgi-4.4.21-1.el7.centos.x86_64.rpm
useradd -r rmap mkdir /home/rmap chown rmap:rmap /home/rmap mkdir /rmap/cache chown rmap:rmap /rmap/cache
/etc/httpd/conf.modules.d/00-mpm.conf
LoadModule mpm_worker_module modules/mod_mpm_worker.so <IfModule mpm_worker_module> #StartServers 2 #MaxClients 150 #MinSpareThreads 25 #MaxSpareThreads 75 #ThreadsPerChild 25 #MaxRequestsPerChild 0 ServerLimit 16 StartServers 2 MaxRequestWorkers 150 MinSpareThreads 10 MaxSpareThreads 35 ThreadsPerChild 15 MaxRequestWorkers 240 MaxConnectionsPerChild 10000 </IfModule>
/etc/httpd/conf.d/rmap.conf
ServerName rmap.it WSGISocketPrefix /run/wsgirmap/rmap WSGIDaemonProcess www.rmap.cc user=rmap group=rmap maximum-requests=100 graceful-timeout=200 processes=10 threads=5 request-timeout=180 socket-timeout=180 header-buffer- size=65000 WSGIProcessGroup www.rmap.cc WSGIApplicationGroup %{GLOBAL} <VirtualHost *:80 > ServerName rmap.it ServerAlias rmap.cc rmapv.rmap.cc rmapv.rmap.it www.rmap.cc www.rmapv.rmap.cc www.rmap.it www.rmapv.rmap.it localhost localhost.localdomain 127.0.0.1 partecipa.rainbolife.eu Include conf.d/rmap.inc </VirtualHost>
chkconfig httpd on service httpd start
Sincronizzazione DB
Server di origine
rmapctrl --dumpdata > dumpdata.json
rimuovere le prime righe che non sono json
dbadb export --dsn="mysql:///report_fixed?user=rmap&password=****" > report_fixed.bufr dbadb export --dsn="mysql:///report_mobile?user=rmap&password=****" > report_mobile.bufr dbadb export --dsn="mysql:///sample_fixed?user=rmap&password=****" > sample_fixed.bufr dbadb export --dsn="mysql:///sample_mobile?user=rmap&password=****" > sample_mobile.bufr
Server di destinazione
Da interfaccia web admin rimuovere TUTTI gli utenti (compreso rmap)
rmapctrl --loaddata=dumpdata.json
dbadb import --wipe-first --dsn="postgresql://rmap:***@localhost/report_fixed" report_fixed.bufr dbadb import --wipe-first --dsn="postgresql://rmap:***@localhost/report_mobile" report_mobile.bufr dbadb import --wipe-first --dsn="postgresql://rmap:***@localhost/sample_mobile" sample_mobile.bufr dbadb import --wipe-first --dsn="postgresql://rmap:***@localhost/sample_fixed" sample_fixed.bufr