A free open source IT asset/license management system
Update docker support for upcoming v3
Brady Wetheringtonf03ecd9d083d
diff --git a/Dockerfile b/Dockerfileindex 993308de2f..0afedffd4d 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,4 +1,4 @@-FROM ubuntu:wily+FROM ubuntu:trustyMAINTAINER Brady Wetherington <[email protected]>RUN apt-get update && apt-get install -y \@@ -12,7 +12,8 @@ php5-gd \patch \curl \vim \-git+git \+mysql-clientRUN php5enmod mcryptRUN php5enmod gd@@ -28,6 +29,7 @@ RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvarsCOPY docker/000-default.conf /etc/apache2/sites-enabled/000-default.conf#SSL+RUN mkdir -p /var/lib/snipeit/sslCOPY docker/001-default-ssl.conf /etc/apache2/sites-enabled/001-default-ssl.conf#COPY docker/001-default-ssl.conf /etc/apache2/sites-available/001-default-ssl.conf@@ -43,13 +45,21 @@ RUN a2enmod rewriteWORKDIR /var/www/html#Append to bootstrap file (less brittle than 'patch')-RUN sed -i 's/return $app;/$env="production";\nreturn $app;/' bootstrap/start.php+# RUN sed -i 's/return $app;/$env="production";\nreturn $app;/' bootstrap/start.php#copy all configuration files-COPY docker/*.php /var/www/html/app/config/production/+# COPY docker/*.php /var/www/html/app/config/production/+COPY docker/docker.env /var/www/html/.envRUN chown -R docker /var/www/html+RUN \+ rm -r "/var/www/html/app/private_uploads" && ln -fs "/var/lib/snipeit/data/private_uploads" "/var/www/html/app/private_uploads" && \+ rm -r "/var/www/html/public/uploads/avatars" && ln -fs "/var/lib/snipeit/data/uploads/avatars" "/var/www/html/public/uploads/avatars" && \+ rm -r "/var/www/html/public/uploads/models" && ln -fs "/var/lib/snipeit/data/uploads/models" "/var/www/html/public/uploads/models" && \+ rm -r "/var/www/html/public/uploads/suppliers" && ln -fs "/var/lib/snipeit/data/uploads/suppliers" "/var/www/html/public/uploads/suppliers" && \+ rm -r "/var/www/html/app/storage/dumps" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/app/storage/dumps"+############## DEPENDENCIES via COMPOSER ####################global install of composer@@ -67,6 +77,10 @@ RUN cd /var/www/html;composer install#RUN chmod +x /tmp/app_install.exp#RUN /tmp/app_install.exp+############### DATA VOLUME #################++VOLUME [/var/lib/snipeit]+##### START SERVERCOPY docker/entrypoint.sh /entrypoint.shdiff --git a/docker.env b/docker.envindex 67c9b37d70..4f48132d21 100644--- a/docker.env+++ b/docker.env@@ -1,6 +1,7 @@# Docker Environment File#Database Variables+MYSQL_ROOT_PASSWORD=supersecuresecretthingMYSQL_DATABASE=snipeitMYSQL_USER=snipeitMYSQL_PASSWORD=tinglewingler@@ -15,6 +16,9 @@ [email protected]MAIL_ENV_PASSWORD=N7AqLufTZMULWHWYwJ0ZCw#SNIPE-IT Variables-SNIPEIT_TIMEZONE=America/Los_Angeles-SNIPEIT_LOCALE=es-ES-SERVER_URL=https://192.168.99.100:32775+APP_ENV=develop+APP_DEBUG=true+APP_KEY=Y5hJeC7x1i7OxhDrvrQPlB9KvCorvRdO+APP_URL=http://127.0.0.1:32782+APP_TIMEZONE=US/Pacific+APP_LOCALE=endiff --git a/docker/001-default-ssl.conf b/docker/001-default-ssl.confindex ed3f60bfda..dc55d30d5d 100644--- a/docker/001-default-ssl.conf+++ b/docker/001-default-ssl.conf@@ -38,9 +38,9 @@# If both key and certificate are stored in the same file, only the# SSLCertificateFile directive is needed.#SSLCertificateFile /etc/ssl/private/ssl-cert-snakeoil.crt- SSLCertificateFile /etc/ssl/private/snipeit-ssl.crt+ SSLCertificateFile /var/lib/snipeit/ssl/snipeit-ssl.crt#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key- SSLCertificateKeyFile /etc/ssl/private/snipeit-ssl.key+ SSLCertificateKeyFile /var/lib/snipeit/ssl/snipeit-ssl.key# Server Certificate Chain:# Point SSLCertificateChainFile at a file containing thediff --git a/docker/app.php b/docker/app.phpdeleted file mode 100644index 529ed6c85a..0000000000--- a/docker/app.php+++ /dev/null@@ -1,49 +0,0 @@-<?php--return array(-- /*- |--------------------------------------------------------------------------- | Application Debug Mode- |--------------------------------------------------------------------------- |- | When your application is in debug mode, detailed error messages with- | stack traces will be shown on every error that occurs within your- | application. If disabled, a simple generic error page is shown.- |- */-- 'debug' => false,-- 'timezone' => isset($_ENV['SNIPEIT_TIMEZONE']) ? $_ENV['SNIPEIT_TIMEZONE'] : 'UTC',- 'locale' => isset($_ENV['SNIPEIT_LOCALE']) ? $_ENV['SNIPEIT_LOCALE'] : 'en',--- /*- |--------------------------------------------------------------------------- | Application URL- |--------------------------------------------------------------------------- |- | This URL is used by the console to properly generate URLs when using- | the Artisan command line tool. You should set this to the root of- | your application so that it is used when running Artisan tasks.- |- */-- 'url' => isset($_ENV['SERVER_URL']) ? $_ENV['SERVER_URL'] : 'https://production.yourserver.com',-- /*- |--------------------------------------------------------------------------- | Encryption Key- |--------------------------------------------------------------------------- |- | This key is used by the Illuminate encrypter service and should be set- | to a random, 32 character string, otherwise these encrypted strings- | will not be safe. Please do this before deploying an application!- |- | Run a php artisan key:generate --env=staging to create a random one- */-- 'key' => 'Change_this_key_or_snipe_will_get_ya',--);diff --git a/docker/app_install.exp b/docker/app_install.expdeleted file mode 100644index 956969086c..0000000000--- a/docker/app_install.exp+++ /dev/null@@ -1,77 +0,0 @@-#!/usr/bin/expect -f-#-# This Expect script was generated by autoexpect on Mon Feb 16 23:58:34 2015-# Expect and autoexpect were both written by Don Libes, NIST.-#-# Note that autoexpect does not guarantee a working script. It-# necessarily has to guess about certain things. Two reasons a script-# might fail are:-#-# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,-# etc.) and devices discard or ignore keystrokes that arrive "too-# quickly" after prompts. If you find your new script hanging up at-# one spot, try adding a short sleep just before the previous send.-# Setting "force_conservative" to 1 (see below) makes Expect do this-# automatically - pausing briefly before sending each character. This-# pacifies every program I know of. The -c flag makes the script do-# this in the first place. The -C flag allows you to define a-# character to toggle this mode off and on.--set force_conservative 0 ;# set to 1 to force conservative mode even if- ;# script wasn't run conservatively originally-if {$force_conservative} {- set send_slow {1 .1}- proc send {ignore arg} {- sleep .1- exp_send -s -- $arg- }-}--#-# 2) differing output - Some programs produce different output each time-# they run. The "date" command is an obvious example. Another is-# ftp, if it produces throughput statistics at the end of a file-# transfer. If this causes a problem, delete these patterns or replace-# them with wildcards. An alternative is to use the -p flag (for-# "prompt") which makes Expect only look for the last line of output-# (i.e., the prompt). The -P flag allows you to define a character to-# toggle this mode off and on.-#-# Read the man page for more info.-#-# -Don---set timeout -1-spawn php artisan app:install --no-ansi-match_max 100000-expect -exact "=====================================\r-\r- Step: 1\r-\r- Please follow the following\r- instructions to create your\r- default user.\r-\r--------------------------------------\r-\r-Please enter your first name: "-send -- "Sample\r"-expect -exact "Sample\r-Please enter your last name: "-send -- "User\r"-expect -exact "User\r-Please enter your username: "-send -- "snipeitadmin"-expect -exact "snipeitadmin"-send -- "\r"-Please enter your email: "-send -- "[email protected]"-expect -exact "[email protected]"-send -- "\r"-expect -exact "\r-Please enter your user password (at least 8 characters): "-send -- "example1"-expect -exact "example1"-send -- "\r"-expect eofdiff --git a/docker/database.php b/docker/database.phpdeleted file mode 100755index f2b0f92a30..0000000000--- a/docker/database.php+++ /dev/null@@ -1,125 +0,0 @@-<?php--return array(-- /*- |--------------------------------------------------------------------------- | PDO Fetch Style- |--------------------------------------------------------------------------- |- | By default, database results will be returned as instances of the PHP- | stdClass object; however, you may desire to retrieve records in an- | array format for simplicity. Here you can tweak the fetch style.- |- */-- 'fetch' => PDO::FETCH_CLASS,-- /*- |--------------------------------------------------------------------------- | Default Database Connection Name- |--------------------------------------------------------------------------- |- | Here you may specify which of the database connections below you wish- | to use as your default connection for all database work. Of course- | you may use many connections at once using the Database library.- |- */-- 'default' => 'mysql',-- /*- |--------------------------------------------------------------------------- | Database Connections- |--------------------------------------------------------------------------- |- | Here are each of the database connections setup for your application.- | Of course, examples of configuring each database platform that is- | supported by Laravel is shown below to make development simple.- |- |- | All database work in Laravel is done through the PHP PDO facilities- | so make sure you have the driver for your particular database of- | choice installed on your machine before you begin development.- |- */-- 'connections' => array(-- 'sqlite' => array(- 'driver' => 'sqlite',- 'database' => __DIR__.'/../database/production.sqlite',- 'prefix' => '',- ),-- 'mysql' => array(- 'driver' => 'mysql',- 'host' => $_ENV['MYSQL_PORT_3306_TCP_ADDR'],- 'port' => $_ENV['MYSQL_PORT_3306_TCP_PORT'],- 'database' => $_ENV['MYSQL_ENV_MYSQL_DATABASE'],- 'username' => $_ENV['MYSQL_ENV_MYSQL_USER'],- 'password' => $_ENV['MYSQL_ENV_MYSQL_PASSWORD'],- 'charset' => 'utf8',- 'collation' => 'utf8_unicode_ci',- 'prefix' => '',- ),-- 'pgsql' => array(- 'driver' => 'pgsql',- 'host' => 'localhost',- 'database' => 'database',- 'username' => 'root',- 'password' => '',- 'charset' => 'utf8',- 'prefix' => '',- 'schema' => 'public',- ),-- 'sqlsrv' => array(- 'driver' => 'sqlsrv',- 'host' => 'localhost',- 'database' => 'database',- 'username' => 'root',- 'password' => '',- 'prefix' => '',- ),-- ),-- /*- |--------------------------------------------------------------------------- | Migration Repository Table- |--------------------------------------------------------------------------- |- | This table keeps track of all the migrations that have already run for- | your application. Using this information, we can determine which of- | the migrations on disk have not actually be run in the databases.- |- */-- 'migrations' => 'migrations',-- /*- |--------------------------------------------------------------------------- | Redis Databases- |--------------------------------------------------------------------------- |- | Redis is an open source, fast, and advanced key-value store that also- | provides a richer set of commands than a typical key-value systems- | such as APC or Memcached. Laravel makes it easy to dig right in.- |- */-- 'redis' => array(-- 'cluster' => true,-- 'default' => array(- 'host' => '127.0.0.1',- 'port' => 6379,- 'database' => 0,- ),-- ),--);diff --git a/docker/entrypoint.sh b/docker/entrypoint.shindex 014d759817..7ea4e01d23 100644--- a/docker/entrypoint.sh+++ b/docker/entrypoint.sh@@ -2,18 +2,28 @@cd /var/www/html# fix key if needed-if grep -q Change_this_key_or_snipe_will_get_ya app/config/production/app.php+if [ -z "$APP_KEY" ]then- MYSQL_PORT_3306_TCP_ADDR='' MYSQL_PORT_3306_TCP_PORT='' MYSQL_ENV_MYSQL_DATABASE='' \- MYSQL_ENV_MYSQL_USER='' MYSQL_ENV_MYSQL_PASSWORD='' php artisan --env=production -n key:generate+ echo "Please re-run this container with an environment variable \$APP_KEY"+ echo "An example APP_KEY you could use is: "+ php artisan key:generate --show+ exitfi-if [ -f /etc/ssl/private/snipeit-ssl.crt -a -f /etc/ssl/private/snipeit-ssl.key ]+if [ -f /var/lib/snipeit/ssl/snipeit-ssl.crt -a -f /var/lib/snipeit/ssl/snipeit-ssl.key ]thena2enmod sslelsea2dismod sslfi+# create data directories+for dir in 'data/private_uploads' 'data/uploads' 'data/uploads/avatars' 'data/uploads/models' 'data/uploads/suppliers' 'dumps'; do+ mkdir -p "/var/lib/snipeit/$dir"+done++chown -R docker:root /var/lib/snipeit/data/*+chown -R docker:root /var/lib/snipeit/dumps+. /etc/apache2/envvarsexec apache2 -DNO_DETACH < /dev/nulldiff --git a/docker/ldap.php b/docker/ldap.phpdeleted file mode 100644index 90850a761d..0000000000--- a/docker/ldap.php+++ /dev/null@@ -1,112 +0,0 @@-<?php--return array(-- /*- |--------------------------------------------------------------------------- | URL- |--------------------------------------------------------------------------- |- | URL for the LDAP server. This should start with ldap://, for example:- | ldap://ldap.yourserver.com- |- */- 'url' => isset($_ENV['LDAP_URL']) ? $_ENV['LDAP_URL'] : "",--- /*- |--------------------------------------------------------------------------- | Username- |--------------------------------------------------------------------------- |- | Username to use to connect authenticate to LDAP, for example:- | cn=read-only-admin,dc=example,dc=com- |- */- 'username' => isset($_ENV['LDAP_USERNAME']) ? $_ENV['LDAP_USERNAME'] : "",-- /*- |--------------------------------------------------------------------------- | Password- |--------------------------------------------------------------------------- |- | Password to use when authenticating to LDAP.- |- */- 'password' => isset($_ENV['LDAP_PASSWORD']) ? $_ENV['LDAP_PASSWORD'] : "",-- /*- |--------------------------------------------------------------------------- | Basedn- |--------------------------------------------------------------------------- |- | The base where the search for users will be executed, for example:- | dc=example,dc=com- |- */- 'basedn' => isset($_ENV['LDAP_BASEDN']) ? $_ENV['LDAP_BASEDN'] : "",--- /*- |--------------------------------------------------------------------------- | Filter- |--------------------------------------------------------------------------- |- | The search filter for the LDAP query. This probably does not have to be- | changed.- |- */- 'filter' => isset($_ENV['LDAP_FILTER']) ? $_ENV['LDAP_FILTER'] : "&(cn=*)",--- /*- |--------------------------------------------------------------------------- | LDAP field names that will be retrieved to create a user.- |- | Using the username as an example:- | If I set 'result.username' => 'my-org-username', the code will connect to- | LDAP as follows (where $results[$i] represents a row in the LDAP query:- | $username-to-insert-in-snipe-it = $results[$i]["my-org-username"][0]- |- | Note: all these fields are required.- |--------------------------------------------------------------------------- |- | The search filter for the LDAP query.- |- */- 'result.username' => isset($_ENV['LDAP_RESULT_USERNAME']) ? $_ENV['LDAP_RESULT_USERNAME'] : "",- 'result.last.name' => isset($_ENV['LDAP_RESULT_LAST_NAME']) ? $_ENV['LDAP_RESULT_LAST_NAME'] : "",- 'result.first.name' => isset($_ENV['LDAP_RESULT_FIRST_NAME']) ? $_ENV['LDAP_RESULT_FIRST_NAME'] : "",-- /*- | These fields are optional as not all LDAP directories will have it. If yours- | does not have them, just leave these blank and the extra check will- | be omitted.- */- 'result.active.flag' => isset($_ENV['LDAP_RESULT_ACTIVE_FLAG']) ? $_ENV['LDAP_RESULT_ACTIVE_FLAG'] : "",- 'result.emp.num' => isset($_ENV['LDAP_RESULT_EMP_NUM']) ? $_ENV['LDAP_RESULT_EMP_NUM'] : "",- 'result.email' => isset($_ENV['LDAP_RESULT_EMAIL']) ? $_ENV['LDAP_RESULT_EMAIL'] : "",-- /*- |--------------------------------------------------------------------------- | LDAP filter query for authentication- |--------------------------------------------------------------------------- |- | The LDAP query that we want to execute when authenticating a user. This- | should not have to be changed.- |- */- 'authentication.filter.query' => isset($_ENV['LDAP_AUTHENTICATION_FILTER_QUERY']) ? $_ENV['LDAP_AUTHENTICATION_FILTER_QUERY'] : "uid=",-- /*- |--------------------------------------------------------------------------- | LDAP Version- |--------------------------------------------------------------------------- |- | Version of LDAP you are using.- |- */- 'version' => 3,---);diff --git a/docker/mail.php b/docker/mail.phpdeleted file mode 100755index 676ced1733..0000000000--- a/docker/mail.php+++ /dev/null@@ -1,124 +0,0 @@-<?php--return array(-- /*- |--------------------------------------------------------------------------- | Mail Driver- |--------------------------------------------------------------------------- |- | Laravel supports both SMTP and PHP's "mail" function as drivers for the- | sending of e-mail. You may specify which one you're using throughout- | your application here. By default, Laravel is setup for SMTP mail.- |- | Supported: "smtp", "mail", "sendmail"- |- */-- 'driver' => 'smtp',-- /*- |--------------------------------------------------------------------------- | SMTP Host Address- |--------------------------------------------------------------------------- |- | Here you may provide the host address of the SMTP server used by your- | applications. A default option is provided that is compatible with- | the Postmark mail service, which will provide reliable delivery.- |- */-- 'host' => $_ENV['MAIL_PORT_587_TCP_ADDR'],-- /*- |--------------------------------------------------------------------------- | SMTP Host Port- |--------------------------------------------------------------------------- |- | This is the SMTP port used by your application to delivery e-mails to- | users of your application. Like the host we have set this value to- | stay compatible with the Postmark e-mail application by default.- |- */-- 'port' => $_ENV['MAIL_PORT_587_TCP_PORT'],-- /*- |--------------------------------------------------------------------------- | Global "From" Address- |--------------------------------------------------------------------------- |- | You may wish for all e-mails sent by your application to be sent from- | the same address. Here, you may specify a name and address that is- | used globally for all e-mails that are sent by your application.- |- */-- 'from' => array('address' => $_ENV['MAIL_ENV_FROM_ADDR'], 'name' => $_ENV['MAIL_ENV_FROM_NAME']),-- /*- |--------------------------------------------------------------------------- | E-Mail Encryption Protocol- |--------------------------------------------------------------------------- |- | Here you may specify the encryption protocol that should be used when- | the application send e-mail messages. A sensible default using the- | transport layer security protocol should provide great security.- |- */-- 'encryption' => $_ENV['MAIL_ENV_ENCRYPTION'], //'tls' commonly-- /*- |--------------------------------------------------------------------------- | SMTP Server Username- |--------------------------------------------------------------------------- |- | If your SMTP server requires a username for authentication, you should- | set it here. This will get used to authenticate with your server on- | connection. You may also set the "password" value below this one.- |- */-- 'username' => $_ENV['MAIL_ENV_USERNAME'],-- /*- |--------------------------------------------------------------------------- | SMTP Server Password- |--------------------------------------------------------------------------- |- | Here you may set the password required by your SMTP server to send out- | messages from your application. This will be given to the server on- | connection so that the application will be able to send messages.- |- */-- 'password' => $_ENV['MAIL_ENV_PASSWORD'],-- /*- |--------------------------------------------------------------------------- | Sendmail System Path- |--------------------------------------------------------------------------- |- | When using the "sendmail" driver to send e-mails, we will need to know- | the path to where Sendmail lives on this server. A default path has- | been provided here, which will work well on most of your systems.- |- */-- 'sendmail' => '/usr/sbin/sendmail -bs',-- /*- |--------------------------------------------------------------------------- | Mail "Pretend"- |--------------------------------------------------------------------------- |- | When this option is enabled, e-mail will not actually be sent over the- | web and will instead be written to your application's logs files so- | you may inspect the message. This is great for local development.- |- */-- 'pretend' => false,--);