Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions 2.12.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
FROM ubuntu:24.04

ENV OCS_VERSION 2.12.4

LABEL maintainer="contact@ocsinventory-ng.org" \
version="${OCS_VERSION}" \
description="OCS Inventory docker image"

ARG APT_FLAGS="-y"

ENV APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data \
APACHE_LOG_DIR=/var/log/apache2 APACHE_PID_FILE=/var/run/apache2/apache2.pid APACHE_RUN_DIR=/var/run/apache2 APACHE_LOCK_DIR=/var/lock/apache2 \
OCS_DB_SERVER=dbsrv OCS_DB_PORT=3306 OCS_DB_USER=ocs OCS_DB_PASS=ocs OCS_DB_NAME=ocsweb \
OCS_LOG_DIR=/var/log/ocsinventory-server OCS_VARLIB_DIR=/var/lib/ocsinventory-reports/ OCS_WEBCONSOLE_DIR=/usr/share/ocsinventory-reports \
OCS_PERLEXT_DIR=/etc/ocsinventory-server/perl/ OCS_PLUGINSEXT_DIR=/etc/ocsinventory-server/plugins/ \
OCS_SSL_ENABLED=0 OCS_SSL_WEB_MODE=DISABLED OCS_SSL_COM_MODE=DISABLED OCS_SSL_KEY=/path/to/key OCS_SSL_CERT=/path/to/cert OCS_SSL_CA=/path/to/ca \
TZ=Europe/Paris

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports/ocsreports/extensions

RUN apt-get update && apt-get install -y \
wget \
curl \
make \
perl \
apache2 \
php \
libxml-simple-perl \
libdbi-perl \
libdbd-mysql-perl \
libapache-dbi-perl \
libnet-ip-perl \
libsoap-lite-perl \
libarchive-zip-perl \
libswitch-perl \
libmojolicious-perl \
libplack-perl \
build-essential \
php-pclzip \
php-mbstring \
php-soap \
php-mysql \
php-curl \
php-xml \
php-zip \
php-gd \
php-ldap

RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${OCS_VERSION}/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -P /tmp && \
tar xzf /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -C /tmp;

RUN cd /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Apache/ && \
perl Makefile.PL && \
make && \
make install

WORKDIR /etc/apache2/conf-available

# Redirect Apache2 Logs to stdout e stderr
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log

COPY conf/* /tmp/conf/

COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d

EXPOSE 80

# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]
34 changes: 34 additions & 0 deletions 2.12.4/conf/dbconfig.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/*
* Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
* See the Contributors file for more details about them.
*
* This file is part of OCSInventory-NG/OCSInventory-ocsreports.
*
* OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
* it and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the License,
* or (at your option) any later version.
*
* OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
define("DB_NAME", "OCS_DB_NAME");
define("SERVER_READ", "OCS_READ_NAME");
define("SERVER_WRITE", "OCS_WRITE_NAME");
define("SERVER_PORT", "OCS_DB_PORT");
define("COMPTE_BASE", "OCS_DB_USER");
define("PSWD_BASE", "OCS_DB_PASS");
define("ENABLE_SSL","OCS_SSL_ENABLED");
define("SSL_MODE","OCS_SSL_WEB_MODE");
define("SSL_KEY","OCS_SSL_KEY");
define("SSL_CERT","OCS_SSL_CERT");
define("CA_CERT","OCS_SSL_CA");
?>
120 changes: 120 additions & 0 deletions 2.12.4/conf/ocsinventory-reports.conf
Original file line number Diff line number Diff line change
@@ -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_ALIAS PATH_TO_OCSREPORTS_DIR

<Directory PATH_TO_OCSREPORTS_DIR>
# By default, users can use console from everywhere
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride Options AuthConfig

# Uncomment following to force use of HTTPS in Administration Server
#SSLRequireSSL

# PHP tuning (not working on all distribution, use php.ini instead)
<IfModule mod_php5.c>
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
</IfModule>
# Duplicate for php7 compatibility
<IfModule mod_php7.c>
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
</IfModule>

# Uncomment following to allow HTTP body request up to 4 MB
# instead default 512 KB
#LimitRequestBody 4194304

</Directory>

################################################################################
# Deployment packages download area
#
# Alias to put Deployment package files outside Apache document root directory
#
<Directory PATH_TO_PACKAGES_DIR>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
</Directory>
Alias PACKAGES_ALIAS PATH_TO_PACKAGES_DIR


################################################################################
# Snmp communities area
#
# Alias to put Snmp custom Mibs files outside Apache document root directory
#
<Directory PATH_TO_SNMP_DIR>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
</Directory>
Alias SNMP_ALIAS PATH_TO_SNMP_DIR
23 changes: 23 additions & 0 deletions 2.12.4/conf/ocsinventory-restapi.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PerlOptions +Parent

<Perl>
$ENV{PLACK_ENV} = 'production';
$ENV{MOJO_HOME} = 'REST_API_PATH';
$ENV{MOJO_MODE} = 'deployment';
$ENV{OCS_DB_HOST} = 'DATABASE_SERVER';
$ENV{OCS_DB_PORT} = 'DATABASE_PORT';
$ENV{OCS_DB_LOCAL} = 'DATABASE_NAME';
$ENV{OCS_DB_USER} = 'DATABASE_USER';
$ENV{OCS_DB_PWD} = 'DATABASE_PASSWD';
$ENV{OCS_DB_SSL_ENABLED} = OCS_SSL_ENABLED;
# $ENV{OCS_DB_SSL_CLIENT_KEY} = '';
# $ENV{OCS_DB_SSL_CLIENT_CERT} = '';
# $ENV{OCS_DB_SSL_CA_CERT} = '';
$ENV{OCS_DB_SSL_MODE} = 'SSL_MODE_PREFERRED';
</Perl>

<Location /ocsapi>
SetHandler perl-script
PerlResponseHandler Plack::Handler::Apache2
PerlSetVar psgi_app 'REST_API_LOADER_PATH'
</Location>
Loading