From 297bfe1e5db0a6d3c8ef06d71278c2bafaa7974f Mon Sep 17 00:00:00 2001 From: Valentin Deville Date: Wed, 15 Mar 2017 16:13:00 +0100 Subject: [PATCH] Add 2.3.1 --- 2.3.1/Dockerfile | 119 +++++++++ 2.3.1/conf/ocsinventory-reports.conf | 120 +++++++++ 2.3.1/conf/z-ocsinventory-server.conf | 357 ++++++++++++++++++++++++++ 2.3.1/dbconfig.inc.php | 8 + 2.3.1/scripts/run.sh | 9 + 2.3.1/setup.sh | 101 ++++++++ 6 files changed, 714 insertions(+) create mode 100644 2.3.1/Dockerfile create mode 100644 2.3.1/conf/ocsinventory-reports.conf create mode 100644 2.3.1/conf/z-ocsinventory-server.conf create mode 100644 2.3.1/dbconfig.inc.php create mode 100644 2.3.1/scripts/run.sh create mode 100644 2.3.1/setup.sh diff --git a/2.3.1/Dockerfile b/2.3.1/Dockerfile new file mode 100644 index 0000000..31521e6 --- /dev/null +++ b/2.3.1/Dockerfile @@ -0,0 +1,119 @@ +FROM debian:latest + +LABEL maintainer="contact@ocsinventory-ng.org" +LABEL version="2.3.1" +LABEL description="OCS (Open Computers and Software Inventory Next Generation)" + +RUN apt-get update + +RUN apt-get -y install \ + apache2 \ + apache2-doc \ + apt-utils \ + php5 \ + php5-gd \ + php5-mysql \ + php5-cgi \ + php5-curl \ + perl \ + build-essential \ + libapache2-mod-php5 \ + libxml2 \ + libxml-simple-perl \ + libc6-dev \ + libnet-ip-perl \ + libxml-libxml-perl \ + libapache2-mod-perl2 \ + libdbi-perl \ + libapache-dbi-perl \ + libdbd-mysql-perl \ + libio-compress-perl \ + libxml-simple-perl \ + libsoap-lite-perl \ + libarchive-zip-perl \ + libnet-ip-perl \ + libphp-pclzip \ + libsoap-lite-perl \ + libarchive-zip-perl \ + htop \ + git \ + wget \ + tar \ + unzip \ + nano \ + make + +RUN cpan -i XML::Entities +VOLUME /var/lib/mysql + +RUN cp /usr/share/zoneinfo/Europe/Paris /etc/localtime + +RUN /usr/sbin/a2dissite 000-default ;\ + /usr/sbin/a2enmod rewrite ;\ + /usr/sbin/a2enmod ssl ;\ + /usr/sbin/a2enmod authz_user + +RUN wget https://raw.githubusercontent.com/OCSInventory-NG/OCSInventory-Server/master/binutils/docker-download.sh +RUN sh docker-download.sh 2.3.1 + +WORKDIR /tmp/ocs/Apache +RUN perl Makefile.PL ;\ + make ;\ + make install + +RUN cp -R blib/lib/Apache /usr/local/share/perl/5.20.2/ ;\ + cp -R Ocsinventory /usr/local/share/perl/5.20.2/ ;\ + cp /tmp/ocs/etc/logrotate.d/ocsinventory-server /etc/logrotate.d/ + +RUN mkdir -p /etc/ocsinventory-server/plugins ;\ + mkdir -p /etc/ocsinventory-server/perl ;\ + mkdir -p /usr/share/ocsinventory-reports/ocsreports + +ENV APACHE_RUN_USER www-data +ENV APACHE_RUN_GROUP www-data +ENV APACHE_LOG_DIR /var/log/apache2 +ENV APACHE_PID_FILE /var/run/apache2.pid +ENV APACHE_RUN_DIR /var/run/apache2f +ENV APACHE_LOCK_DIR /var/lock/apache2 +ENV APACHE_LOG_DIR /var/log/apache2 + + +WORKDIR /tmp/ocs + +RUN cp -R ocsreports/* /usr/share/ocsinventory-reports/ocsreports + +RUN chown -R www-data: /usr/share/ocsinventory-reports/ + +RUN bash -c 'mkdir -p /var/lib/ocsinventory-reports/{download,ipd,logs,scripts,snmp}' + +RUN chmod -R +w /var/lib/ocsinventory-reports ;\ + chown www-data: -R /var/lib/ocsinventory-reports + +COPY dbconfig.inc.php /usr/share/ocsinventory-reports/ocsreports/ + +RUN cp binutils/ipdiscover-util.pl /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl + +RUN chown www-data: /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl ;\ + chmod 755 /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl ;\ + chmod +w /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php ;\ + mkdir -p /var/log/ocsinventory-server/ ;\ + chmod +w /var/log/ocsinventory-server/ + +COPY /conf/ocsinventory-reports.conf /etc/apache2/conf-available/ +COPY /conf/z-ocsinventory-server.conf /etc/apache2/conf-available/ + + +COPY ./scripts/run.sh /root/run.sh +RUN chmod +x /root/run.sh + + +RUN ln -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf +RUN ln -s /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-enabled/z-ocsinventory-server.conf + +RUN rm /usr/share/ocsinventory-reports/ocsreports/install.php ;\ + rm -rf /tmp/ocs + +EXPOSE 80 +EXPOSE 443 + +CMD ["/bin/bash", "/root/run.sh"] diff --git a/2.3.1/conf/ocsinventory-reports.conf b/2.3.1/conf/ocsinventory-reports.conf new file mode 100644 index 0000000..8bcfc1a --- /dev/null +++ b/2.3.1/conf/ocsinventory-reports.conf @@ -0,0 +1,120 @@ +################################################################################ +# +# OCS Inventory NG Administration Server +# +# Copyleft 2008 OCS Inventory NG Team +# Web: http://www.ocsinventory-ng.org +# +# This code is open source and may be copied and modified as long as the source +# code is always made freely available. +# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt +################################################################################ + +# +# ANY CHANGE ON THIS FILE REQUIRES APACHE RESTART TO TAKE EFFECT +# + +################################################################################ +# Administration console public pages +# +# Alias used to put Administration Server static page (typically PHP) outside +# Apache document root directory +# +Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports + + + # By default, users can use console from everywhere + + # Apache 2.4 + Require all granted + + + Order deny,allow + Allow from all + + Options Indexes FollowSymLinks + DirectoryIndex index.php + AllowOverride Options + + # Uncomment following to force use of HTTPS in Administration Server + #SSLRequireSSL + + # PHP tuning (not working on all distribution, use php.ini instead) + + AddType application/x-httpd-php .php + php_flag file_uploads on + # Some PHP tuning for deployment feature up to 8 MB + # post_max_size must be greater than upload_max_filesize + # because of HTTP headers + php_value post_max_size 101m + php_value upload_max_filesize 100m + # You may have to uncomment following on errors + #php_value max_execution_time -1 + #php_value max_input_time -1 + + # Uncomment following if you need to specify a mysql socket + #php_value mysql.default_socket "path/to/mysql/unix/socket" + + #!! Mandatory !! : set magic_quotes_gpc to off (to make ocsreports works correctly) + php_flag magic_quotes_gpc off + + # Duplicate for php7 compatibility + + AddType application/x-httpd-php .php + php_flag file_uploads on + # Some PHP tuning for deployment feature up to 8 MB + # post_max_size must be greater than upload_max_filesize + # because of HTTP headers + php_value post_max_size 101m + php_value upload_max_filesize 100m + # You may have to uncomment following on errors + #php_value max_execution_time -1 + #php_value max_input_time -1 + + # Uncomment following if you need to specify a mysql socket + #php_value mysql.default_socket "path/to/mysql/unix/socket" + + #!! Mandatory !! : set magic_quotes_gpc to off (to make ocsreports works correctly) + php_flag magic_quotes_gpc off + + + # Uncomment following to allow HTTP body request up to 4 MB + # instead default 512 KB + #LimitRequestBody 4194304 + + + +################################################################################ +# Deployment packages download area +# +# Alias to put Deployment package files outside Apache document root directory +# + + + # Apache 2.4 + Require all granted + + + Order deny,allow + Allow from all + + +Alias /download /var/lib/ocsinventory-reports/download + + +################################################################################ +# Snmp communities area +# +# Alias to put Snmp custom Mibs files outside Apache document root directory +# + + + # Apache 2.4 + Require all granted + + + Order deny,allow + Allow from all + + +Alias /snmp /var/lib/ocsinventory-reports/snmp diff --git a/2.3.1/conf/z-ocsinventory-server.conf b/2.3.1/conf/z-ocsinventory-server.conf new file mode 100644 index 0000000..6753b18 --- /dev/null +++ b/2.3.1/conf/z-ocsinventory-server.conf @@ -0,0 +1,357 @@ +################################################################################ +# +# OCS Inventory NG Communication Server Perl Module Setup +# +# Copyleft 2006 Pascal DANEK +# Web: http://www.ocsinventory-ng.org +# +# This code is open source and may be copied and modified as long as the source +# code is always made freely available. +# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt +################################################################################ + + + + # Which version of mod_perl we are using + # For mod_perl <= 1.999_21, replace 2 by 1 + # For mod_perl > 1.999_21, replace 2 by 2 + PerlSetEnv OCS_MODPERL_VERSION 2 + + # Master Database settings + # Replace localhost by hostname or ip of MySQL server for WRITE + PerlSetEnv OCS_DB_HOST ${OCS_DBSERVER_WRITE} + # Replace 3306 by port where running MySQL server, generally 3306 + PerlSetEnv OCS_DB_PORT 3306 + # Name of database + PerlSetEnv OCS_DB_NAME ${OCS_DBNAME} + PerlSetEnv OCS_DB_LOCAL ${OCS_DBNAME} + # User allowed to connect to database + PerlSetEnv OCS_DB_USER ${OCS_DBUSER} + # Password for user + PerlSetVar OCS_DB_PWD ${OCS_DBPASS} + + # Slave Database settings + # Replace localhost by hostname or ip of MySQL server for READ + # Useful if you handle mysql slave databases + # PerlSetEnv OCS_DB_SL_HOST localhost + # Replace 3306 by port where running MySQL server, generally 3306 + # PerlSetEnv OCS_DB_SL_PORT_SLAVE 3306 + # User allowed to connect to database + # PerlSetEnv OCS_DB_SL_USER ocs + # Name of the database + # PerlSetEnv OCS_DB_SL_NAME ocsweb + # Password for user + # PerlSetVar OCS_DB_SL_PWD ocs + + # Path to log directory (must be writeable) + PerlSetEnv OCS_OPT_LOGPATH "/var/log/ocsinventory-server" + + # If you need to specify a mysql socket that the client's built-in + #PerlSetEnv OCS_OPT_DBI_MYSQL_SOCKET "path/to/mysql/unix/socket" + # DBI verbosity + PerlSetEnv OCS_OPT_DBI_PRINT_ERROR 0 + + # Unicode support + PerlSetEnv OCS_OPT_UNICODE_SUPPORT 1 + + # If you are using a multi server architecture, + # Put the ip addresses of the slaves on the master + # (This is read as perl regular expressions) + PerlAddVar OCS_OPT_TRUSTED_IP 127.0.0.1 + #PerlAddVar OCS_OPT_TRUSTED_IP XXX.XXX.XXX.XXX + +# ===== WEB SERVICE (SOAP) SETTINGS ===== + + PerlSetEnv OCS_OPT_WEB_SERVICE_ENABLED 0 + PerlSetEnv OCS_OPT_WEB_SERVICE_RESULTS_LIMIT 100 + # PerlSetEnv OCS_OPT_WEB_SERVICE_PRIV_MODS_CONF "WEBSERV_PRIV_MOD_CONF_FILE" + +# Be careful: you must restart apache to make settings taking effects + + # Configure engine to use the settings from this file + PerlSetEnv OCS_OPT_OPTIONS_NOT_OVERLOADED 0 + + # Try to use other compress algorithm than raw zlib + # GUNZIP and clear XML are supported + PerlSetEnv OCS_OPT_COMPRESS_TRY_OTHERS 1 + +############################################################## +# ===== OPTIONS BELOW ARE OVERLOADED IF YOU USE OCS GUI =====# +############################################################## + +# NOTE: IF YOU WANT TO USE THIS CONFIG FILE INSTEAD, set OCS_OPT_OPTIONS_NOT_OVERLOADED to '1' + +# ===== MAIN SETTINGS ===== + + # Enable engine logs (see LOGPATH setting) + PerlSetEnv OCS_OPT_LOGLEVEL 0 + # Specify agent's prolog frequency + PerlSetEnv OCS_OPT_PROLOG_FREQ 12 + # Configure the duplicates detection system + PerlSetEnv OCS_OPT_AUTO_DUPLICATE_LVL 15 + # Specify if agent take contact on service startup + PerlSetEnv OCS_OPT_INVENTORY_ON_STARTUP 0 + # Futur security improvements + PerlSetEnv OCS_OPT_SECURITY_LEVEL 0 + # Validity of a computer's lock + PerlSetEnv OCS_OPT_LOCK_REUSE_TIME 600 + # Enable the history tracking system (useful for external data synchronisation + PerlSetEnv OCS_OPT_TRACE_DELETED 0 + +# ===== INVENTORY SETTINGS ===== + + # Specify the validity of inventory data + PerlSetEnv OCS_OPT_FREQUENCY 0 + # Configure engine to update inventory regarding to CHECKSUM agent value (lower DB backend load) + PerlSetEnv OCS_OPT_INVENTORY_DIFF 1 + # Make engine consider an inventory as a transaction (lower concurency, better disk usage) + PerlSetEnv OCS_OPT_INVENTORY_TRANSACTION 1 + # Configure engine to make a differential update of inventory sections (row level). Lower DB backend load, higher frontend load + PerlSetEnv OCS_OPT_INVENTORY_WRITE_DIFF 1 + # Enable some stuff to improve DB queries, especially for GUI multicriteria searching system + PerlSetEnv OCS_OPT_INVENTORY_CACHE_ENABLED 1 + # Specify when the engine will clean the inventory cache structures + PerlSetEnv OCS_OPT_INVENTORY_CACHE_REVALIDATE 7 + # Enable you to keep trace of every elements encountered in db life + PerlSetEnv OCS_OPT_INVENTORY_CACHE_KEEP 1 + +# ===== SOFTWARES DEPLOYMENT SETTINGS ===== + + # Enable this feature + PerlSetEnv OCS_OPT_DOWNLOAD 0 + # Package which have a priority superior than this value will not be downloaded + PerlSetEnv OCS_OPT_DOWNLOAD_PERIOD_LENGTH 10 + # Time between two download cycles (bandwidth control) + PerlSetEnv OCS_OPT_DOWNLOAD_CYCLE_LATENCY 60 + # Time between two fragment downloads (bandwidth control) + PerlSetEnv OCS_OPT_DOWNLOAD_FRAG_LATENCY 60 + # Specify if you want to track packages affected to a group on computer's level + PerlSetEnv OCS_OPT_DOWNLOAD_GROUPS_TRACE_EVENTS 1 + # Time between two download periods (bandwidth control) + PerlSetEnv OCS_OPT_DOWNLOAD_PERIOD_LATENCY 60 + # Agents will send ERR_TIMEOUT event and clean the package it is older than this setting + PerlSetEnv OCS_OPT_DOWNLOAD_TIMEOUT 7 + # Agents will send an error event and clean the package if package command does not respond during this setting + PerlSetEnv OCS_OPT_DOWNLOAD_EXECUTION_TIMEOUT 120 + + # Enable ocs engine to deliver agent's files (deprecated) + PerlSetEnv OCS_OPT_DEPLOY 0 + # Enable the softwares deployment capacity (bandwidth control) + +# ===== GROUPS SETTINGS ===== + + # Enable the computer\s groups feature + PerlSetEnv OCS_OPT_ENABLE_GROUPS 1 + # Random number computed in the defined range. Designed to avoid computing many groups in the same process + PerlSetEnv OCS_OPT_GROUPS_CACHE_OFFSET 43200 + # Specify the validity of computer's groups (default: compute it once a day - see offset) + PerlSetEnv OCS_OPT_GROUPS_CACHE_REVALIDATE 43200 + +# ===== IPDISCOVER SETTINGS ===== + + # Specify how much agent per LAN will discovered connected peripherals (0 to disable) + PerlSetEnv OCS_OPT_IPDISCOVER 2 + # Specify the minimal difference to replace an ipdiscover agent + PerlSetEnv OCS_OPT_IPDISCOVER_BETTER_THRESHOLD 1 + # Time between 2 arp requests (mini: 10 ms) + PerlSetEnv OCS_OPT_IPDISCOVER_LATENCY 100 + # Specify when to remove a computer when it has not come until this period + PerlSetEnv OCS_OPT_IPDISCOVER_MAX_ALIVE 14 + # Disable the time before a first election (not recommended) + PerlSetEnv OCS_OPT_IPDISCOVER_NO_POSTPONE 0 + # Enable groups for ipdiscover (for example, you might want to prevent some groups to be ipdiscover agents) + PerlSetEnv OCS_OPT_IPDISCOVER_USE_GROUPS 1 + +# ===== INVENTORY FILES MAPPING SETTINGS ===== + + # Use with ocsinventory-injector, enable the multi entities feature + PerlSetEnv OCS_OPT_GENERATE_OCS_FILES 0 + # Generate either compressed file or clear XML text + PerlSetEnv OCS_OPT_OCS_FILES_FORMAT OCS + # Specify if you want to keep trace of all inventory between to synchronisation with the higher level server + PerlSetEnv OCS_OPT_OCS_FILES_OVERWRITE 0 + # Path to ocs files directory (must be writeable) + PerlSetEnv OCS_OPT_OCS_FILES_PATH /tmp + +# ===== FILTER SETTINGS ===== + + # Enable prolog filter stack + PerlSetEnv OCS_OPT_PROLOG_FILTER_ON 0 + # Enable core filter system to modify some things "on the fly" + PerlSetEnv OCS_OPT_INVENTORY_FILTER_ENABLED 0 + # Enable inventory flooding filter. A dedicated ipaddress ia allowed to send a new computer only once in this period + PerlSetEnv OCS_OPT_INVENTORY_FILTER_FLOOD_IP 0 + # Period definition for INVENTORY_FILTER_FLOOD_IP + PerlSetEnv OCS_OPT_INVENTORY_FILTER_FLOOD_IP_CACHE_TIME 300 + # Enable inventory filter stack + PerlSetEnv OCS_OPT_INVENTORY_FILTER_ON 0 + +# ===== DATA FILTER ===== + + #Enable the dat filtering capacity + PerlSetEnv OCS_OPT_DATA_FILTER 0 + + # Set the table names and the field associated you want to filter + #PerlAddVar OCS_OPT_DATA_TO_FILTER HARDWARE + #PerlAddVar OCS_OPT_DATA_TO_FILTER USERID + + +# ===== REGISTRY SETTINGS ===== + + # Enable the registry capacity + PerlSetEnv OCS_OPT_REGISTRY 1 + +# ===== SNMP SETTINGS ===== + + # Enable the SNMP capacity + PerlSetEnv OCS_OPT_SNMP 0 + # Configure engine to update snmp inventory regarding to snmp_laststate table (lower DB backend load) + PerlSetEnv OCS_OPT_SNMP_INVENTORY_DIFF 1 + # Display error message about agent https communication in logfile + PerlSetEnv OCS_OPT_SNMP_PRINT_HTTPS_ERROR 1 + +# ===== SESSION SETTINGS ===== +# Not yet in GUI + + # Validity of a session (prolog=>postinventory) + PerlSetEnv OCS_OPT_SESSION_VALIDITY_TIME 600 + # Consider a session obsolete if it is older thant this value + PerlSetEnv OCS_OPT_SESSION_CLEAN_TIME 86400 + # Accept an inventory only if required by server + #( Refuse "forced" inventory) + PerlSetEnv OCS_OPT_INVENTORY_SESSION_ONLY 0 + +# ===== TAG ===== + + # The default behavior of the server is to ignore TAG changes from the + # agent. + PerlSetEnv OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT 0 + +# ===== EXTERNAL USERAGENTS ===== + + #Path for external useragents reference file + #!! WARNING !! : external agents may not be supported by OCS NG Community ! + #PerlSetEnv OCS_OPT_EXT_USERAGENTS_FILE_PATH /tmp/yourfile.txt + +# ===== PLUGINS ===== + + PerlSetEnv OCS_PLUGINS_PERL_DIR "/etc/ocsinventory-server/perl" + PerlSetEnv OCS_PLUGINS_CONF_DIR "/etc/ocsinventory-server/plugins" + +# ===== DEPRECATED ===== + + # Set the proxy cache validity in http headers when sending a file + PerlSetEnv OCS_OPT_PROXY_REVALIDATE_DELAY 3600 + # Deprecated + PerlSetEnv OCS_OPT_UPDATE 0 + +############ DO NOT MODIFY BELOW ! ####################### + + # External modules + PerlModule Apache::DBI + PerlModule Compress::Zlib + PerlModule XML::Simple + + # Ocs plugins + PerlModule Apache::Ocsinventory::Plugins::Apache + PerlModule Apache::Ocsinventory::Plugins + + # Ocs + PerlModule Apache::Ocsinventory + PerlModule Apache::Ocsinventory::Server::Constants + PerlModule Apache::Ocsinventory::Server::System + PerlModule Apache::Ocsinventory::Server::Communication + PerlModule Apache::Ocsinventory::Server::Inventory + PerlModule Apache::Ocsinventory::Server::Duplicate + + # Capacities + PerlModule Apache::Ocsinventory::Server::Capacities::Registry + PerlModule Apache::Ocsinventory::Server::Capacities::Update + PerlModule Apache::Ocsinventory::Server::Capacities::Ipdiscover + PerlModule Apache::Ocsinventory::Server::Capacities::Download + PerlModule Apache::Ocsinventory::Server::Capacities::Notify + PerlModule Apache::Ocsinventory::Server::Capacities::Snmp + # This module guides you through the module creation + # PerlModule Apache::Ocsinventory::Server::Capacities::Example + # This module adds some rules to filter some request sent to ocs server in the prolog and inventory stages + # PerlModule Apache::Ocsinventory::Server::Capacities::Filter + # This module add availibity to filter data from HARDWARE section (data filtered won't be stored in database) + # PerlModule Apache::Ocsinventory::Server::Capacities::Datafilter + + # PerlTaintCheck On + + # SSL apache settings + #SSLEngine "SSL_ENABLE" + #SSLCertificateFile "SSL_CERTIFICATE_FILE" + #SSLCertificateKeyFile "SSL_CERTIFICATE_KEY_FILE" + #SSLCACertificateFile "SSL_CERTIFICATE_FILE" + #SSLCACertificatePath "SSL_CERTIFICATE_PATH" + #SSLVerifyClient "SSL_VALIDATE_CLIENT" + + # Engine apache settings + # "Virtual" directory for handling OCS Inventory NG agents communications + # Be careful, do not create such directory into your web server root document ! + + + # Apache 2.4 + Require all granted + + + # Apache 2.2 + order deny,allow + allow from all + + # If you protect this area you have to deal with http_auth_* agent's parameters + # AuthType Basic + # AuthName "OCS Inventory agent area" + # AuthUserFile "APACHE_AUTH_USER_FILE" + # require valid-user + SetHandler perl-script + PerlHandler Apache::Ocsinventory + + +#Web Service for plugin engine + + + # Apache 2.4 + Require local + + + # Apache 2.2 + order deny,allow + allow from 127.0.0.1 + + SetHandler perl-script + PerlHandler Apache::Ocsinventory::Plugins::Apache + + + + # Web service apache settings + PerlModule Apache::Ocsinventory::SOAP + + + SetHandler perl-script + PerlHandler "Apache::Ocsinventory::SOAP" + + # By default, you can query web service from everywhere with a valid user + + # Apache 2.4 + Require all granted + + + Order deny,allow + Allow from all + + AuthType Basic + AuthName "OCS Inventory SOAP Area" + # Use htpasswd to create/update soap-user (or another granted user) + AuthUserFile "APACHE_AUTH_USER_FILE" + + # Apache 2.4 + Require user "SOAP_USER" + + + require "SOAP_USER" + + + diff --git a/2.3.1/dbconfig.inc.php b/2.3.1/dbconfig.inc.php new file mode 100644 index 0000000..d68acb8 --- /dev/null +++ b/2.3.1/dbconfig.inc.php @@ -0,0 +1,8 @@ + diff --git a/2.3.1/scripts/run.sh b/2.3.1/scripts/run.sh new file mode 100644 index 0000000..1fd8278 --- /dev/null +++ b/2.3.1/scripts/run.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ ! -d "$APACHE_RUN_DIR" ]; then + mkdir "$APACHE_RUN_DIR" + chown $APACHE_RUN_USER:$APACHE_RUN_GROUP "$APACHE_RUN_DIR" +fi +if [ -f "$APACHE_PID_FILE" ]; then + rm "$APACHE_PID_FILE" +fi +/usr/sbin/apache2ctl -D FOREGROUND diff --git a/2.3.1/setup.sh b/2.3.1/setup.sh new file mode 100644 index 0000000..038c87c --- /dev/null +++ b/2.3.1/setup.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +echo "Welcome to OCSInventory Docker image setup" + + +echo "Please specify container name" +read containerName +while ! [[ $containerName =~ ^[[:lower:]_]+$ ]]; do + echo "Please choose another name without uppercase and number, only letters." + read containerName +done +echo "Your container name: $containerName" + + +echo "Please specify your database parameters in next steps:" + +echo "Database name" +read databaseName +while ! [[ $databaseName =~ ^[a-zA-Z_0-9]+$ ]]; do + echo "Please choose valid database name" + read databaseName +done + +echo "Database server READ" +read databaseServerRead +while ! [[ $databaseServerRead =~ ^[a-zA-Z_0-9.]+$ ]]; do + echo "Please choose valid database server" + read databaseServerRead +done + + +echo "Database server WRITE" +read databaseServerWrite +while ! [[ $databaseServerWrite =~ ^[a-zA-Z_0-9.]+$ ]]; do + echo "Please choose valid database server" + read databaseServerWrite +done + + +echo "Database user" +read databaseUser +while ! [[ $databaseUser =~ ^[a-zA-Z_0-9]+$ ]]; do + echo "Please choose valid database user" + read databaseUser +done + +echo "Database password" +read databasePassword +while [[ -z $databasePassword ]]; do + echo "Please choose valid database password" + read databasePassword +done + +echo "Do you want to attach existing data volume ? (yes / no)" +read dataVolume + +VOLUME_ARGS="" +if [ $dataVolume = "yes" ] +then + echo "Name of data volume:" + read dataVolumeName + VOLUME_ARGS="-v ${dataVolumeName}:/usr/share/ocsinventory-reports/ocsreports/ -v ${dataVolumeName}:/etc/ocsinventory-reports/ -v ${dataVolumeName}:/var/lib/ocsinventory-reports/" +fi + + +BASEPATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +#MODIFY APACHE CONFIGURATION +#sed -i -e "s/PerlSetEnv OCS_DB_HOST localhost/PerlSetEnv OCS_DB_HOST ${databaseServerWrite}/g" $BASEPATH/conf/z-ocsinventory-server.conf +#sed -i -e "s/PerlSetEnv OCS_DB_NAME ocsweb/PerlSetEnv OCS_DB_NAME ${databaseName}/g" $BASEPATH/conf/z-ocsinventory-server.conf +#sed -i -e "s/PerlSetEnv OCS_DB_LOCAL ocsweb/PerlSetEnv OCS_DB_LOCAL ${databaseName}/g" $BASEPATH/conf/z-ocsinventory-server.conf +#sed -i -e "s/PerlSetEnv OCS_DB_USER ocs/PerlSetEnv OCS_DB_USER ${databaseUser}/g" $BASEPATH/conf/z-ocsinventory-server.conf +#sed -i -e "s/PerlSetVar OCS_DB_PWD ocs/PerlSetVar OCS_DB_PWD ${databasePassword}/g" $BASEPATH/conf/z-ocsinventory-server.conf + + + +COMMAND="docker run -p 80:80 --name ${containerName} -e OCS_DBNAME=${databaseName} \ +-e OCS_DBSERVER_READ=${databaseServerRead} -e OCS_DBSERVER_WRITE=${databaseServerWrite} \ +-e OCS_DBUSER=${databaseUser} -e OCS_DBPASS=${databasePassword} ${VOLUME_ARGS} -itd ocsinventory/ocsinventory-docker-image:master" + +echo "=========================================" +echo "" +echo "The command to launch your container is:" +echo "" +echo ${COMMAND} +echo "" +echo "==========================================" + +echo "" +echo "Do you want to run container now ? (yes / no)" +read launchNow + +if [ $launchNow = "yes" ] +then + $(${COMMAND}) +fi + + + + + +