Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Levent.Sagiroglu committed Sep 7, 2018
0 parents commit 6c4b03e
Show file tree
Hide file tree
Showing 7 changed files with 576 additions and 0 deletions.
86 changes: 86 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FROM alpine:edge
LABEL maintainer "Levent SAGIROGLU <LSagiroglu@gmail.com>"

ARG VERSION=2.5

EXPOSE 80
ENV OCS_DBHOST ""
ENV OCS_DBNAME ""
ENV OCS_DBUSER ""
ENV OCS_DBPASS ""

RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
RUN apk add --update --no-cache bash tar gzip wget make apache2 \
php7-apache2 php7 php7-mysqli php7-pdo_mysql php7-gd php7-memcached \
php7-snmp php7-xml php7-simplexml php7-json php7-pspell php7-mbstring php7-zip php7-soap php7-curl \
py-pip libxml2 perl-xml-simple perl-digest-sha1 perl-compress-raw-zlib perl-dbi \
perl-dbd-mysql perl-dbi perl-net-ip perl-soap-lite apache2-mod-perl
############# php7-xmlrpc php7-xmlreader php7-xmlwriter
WORKDIR /tmp/
RUN wget https://www.cpan.org/authors/id/P/PH/PHRED/Apache-DBI-1.12.tar.gz
RUN tar -xvf Apache-DBI-1.12.tar.gz
WORKDIR /tmp/Apache-DBI-1.12
RUN perl Makefile.PL ;\
make ;\
make install

#############
WORKDIR /tmp/ocs-setup/
RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${VERSION}/OCSNG_UNIX_SERVER_${VERSION}.tar.gz
RUN tar -xvf OCSNG_UNIX_SERVER_${VERSION}.tar.gz --strip 1
WORKDIR /tmp/ocs-setup/Apache
RUN perl Makefile.PL ;\
make ;\
make install ;\
cp -R blib/lib/Apache /usr/local/share/perl5/ ;\
cp /tmp/ocs-setup/etc/logrotate.d/ocsinventory-server /etc/logrotate.d/ ;\
# mkdir -p /etc/ocsinventory-server/{plugins,perl} ;\
bash -c 'mkdir -p /etc/ocsinventory-server/{plugins,perl}' ;\
mkdir -p /usr/share/ocsinventory-reports

WORKDIR /tmp/ocs-setup/
RUN cp -R ocsreports /usr/share/ocsinventory-reports/ ;\
chown root:apache -R /usr/share/ocsinventory-reports/ocsreports ;\
# mkdir -p /var/lib/ocsinventory-reports/{download,ipd,logs,scripts,snmp} ;\
bash -c 'mkdir -p /var/lib/ocsinventory-reports/{download,ipd,logs,scripts,snmp}' ;\
chmod -R +w /var/lib/ocsinventory-reports ;\
chmod -R 777 /usr/share/ocsinventory-reports/ocsreports/plugins ;\
chmod -R 777 /usr/share/ocsinventory-reports/ocsreports/config ;\
chmod -R 777 /usr/share/ocsinventory-reports/ocsreports/upload ;\
# chown root:apache -R /var/lib/ocsinventory-reports/{download,ipd,logs,scripts,snmp} ;\
bash -c 'chown root:apache -R /var/lib/ocsinventory-reports/{download,ipd,logs,scripts,snmp}' ;\
cp binutils/ipdiscover-util.pl /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl ;\
chown root:apache /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl ;\
chmod 755 /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl

RUN sed -i 's,LoadModule mpm_event_module find /mod_mpm_event.so,LoadModule mpm_prefork_module modules/mod_mpm_prefork.so,g' /etc/apache2/httpd.conf
RUN sed -i 's/DirectoryIndex index\.html/DirectoryIndex index\.php/g' /etc/apache2/httpd.conf
RUN sed -i 's,post_max_size = 8M,post_max_size = 101M,g' /etc/php7/php.ini
RUN sed -i 's,upload_max_filesize = 2M,upload_max_filesize =101M,g' /etc/php7/php.ini

COPY *.conf /etc/apache2/conf.d/
#### OPTIONAL PLUGINS #####################################################
WORKDIR /usr/share/ocsinventory-reports/ocsreports/download
# uptime - Retrieve Machine Uptime
RUN wget https://github.com/PluginsOCSInventory-NG/uptime/releases/download/1.1/uptime.zip
# officepack
RUN wget https://github.com/PluginsOCSInventory-NG/officepack/releases/download/2.0/officepack.zip
# vmware-vcenter
RUN wget https://github.com/PluginsOCSInventory-NG/vmware-vcenter/releases/download/1.0/vmware.zip
# winupdate
RUN wget https://github.com/PluginsOCSInventory-NG/winupdate/releases/download/1.1/winupdate.zip
############################################################################
COPY *.php /usr/share/ocsinventory-reports/ocsreports/
# RUN chown root:apache /usr/share/ocsinventory-reports/ocsreports/removeinstall.php ;\
RUN chown root:apache /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php ;\
chmod 777 /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php

# httpd -D FOREGROUND çalışması için
RUN mkdir -p /run/apache2
RUN echo "ServerName localhost" >> /etc/apache2/httpd.conf

RUN mkdir -p /var/log/ocsinventory-server/
# RUN rm /usr/share/ocsinventory-reports/ocsreports/install.php
RUN rm -rf /tmp/*

CMD ["httpd", "-D", "FOREGROUND"]
Binary file added README.md
Binary file not shown.
Empty file added conf.conf
Empty file.
8 changes: 8 additions & 0 deletions dbconfig.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
define("DB_NAME", getenv('OCS_DBNAME'));
define("SERVER_READ", getenv('OCS_DBHOST'));
define("SERVER_WRITE", getenv('OCS_DBHOST'));
define("COMPTE_BASE", getenv('OCS_DBUSER'));
define("PSWD_BASE", getenv('OCS_DBPASS'));
$_SESSION["PSWD_BASE"]=PSWD_BASE;
?>
120 changes: 120 additions & 0 deletions 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 /usr/share/ocsinventory-reports/ocsreports

<Directory /usr/share/ocsinventory-reports/ocsreports>
# 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

# 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 /var/lib/ocsinventory-reports/download>
<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 /download /var/lib/ocsinventory-reports/download


################################################################################
# Snmp communities area
#
# Alias to put Snmp custom Mibs files outside Apache document root directory
#
<Directory /var/lib/ocsinventory-reports/snmp>
<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 /var/lib/ocsinventory-reports/snmp
5 changes: 5 additions & 0 deletions removeinstall.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

if (rename('install.php' , 'install.bak')) {
echo "install.php renemad to install.bak";
} else echo "error";
Loading

0 comments on commit 6c4b03e

Please sign in to comment.