Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom startup scripts #446

Merged
merged 16 commits into from
Dec 27, 2018
Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 1 addition & 1 deletion .devilbox/www/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


$DEVILBOX_VERSION = 'v0.15';
$DEVILBOX_DATE = '2018-12-23';
$DEVILBOX_DATE = '2018-12-26';
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';

//
Expand Down
2 changes: 1 addition & 1 deletion .devilbox/www/htdocs/info_vhostgen.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<p>Note: If the resulting virtual host config does not reflect the vhost-gen template changes, you will need to restart the Devilbox.</p>
<a href="/vhosts.php"><i class="fa fa-chevron-left" aria-hidden="true"></i> Overview</a><br/>
<br/><h3>virtual host config</h3><br/>
<a title="Virtual host: <?php echo $vHost['name'];?>.conf" target="_blank" href="/vhost.d/<?php echo $vhost;?>.conf">
<a title="Virtual host: <?php echo $vhost;?>.conf" target="_blank" href="/vhost.d/<?php echo $vhost;?>.conf">
<i class="fa fa-external-link" aria-hidden="true"></i> <?php echo $vhost;?>.conf
</a>
<br/><br/><h3>vhost-gen config</h3><br/>
Expand Down
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@
/cfg/php-fpm-7.3/*.conf
/cfg/php-fpm-7.4/*.conf

# Ignore custom PHP-FPM startup scripts
/cfg/php-startup-5.2/*.sh
/cfg/php-startup-5.3/*.sh
/cfg/php-startup-5.4/*.sh
/cfg/php-startup-5.5/*.sh
/cfg/php-startup-5.6/*.sh
/cfg/php-startup-7.0/*.sh
/cfg/php-startup-7.1/*.sh
/cfg/php-startup-7.2/*.sh
/cfg/php-startup-7.3/*.sh
/cfg/php-startup-7.4/*.sh

# Ignore custom PHP-FPM modules
/mod/php-fpm-5.2/*.so
/mod/php-fpm-5.3/*.so
Expand Down
2 changes: 1 addition & 1 deletion .tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pull:
@echo "####################################################################################################"
@echo "# PULLING LATEST CONTAINER"
@echo "####################################################################################################"
cd $(DEVILBOX_PATH) && docker-compose pull
cd $(DEVILBOX_PATH) && until docker-compose pull; do sleep 1; done
@echo
@echo

Expand Down
6 changes: 6 additions & 0 deletions cfg/php-startup-5.2/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
13 changes: 13 additions & 0 deletions cfg/php-startup-5.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom startup scripts

Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.

A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`


## Important

All provided scripts will be executed with **root** permissions.
6 changes: 6 additions & 0 deletions cfg/php-startup-5.3/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
13 changes: 13 additions & 0 deletions cfg/php-startup-5.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom startup scripts

Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.

A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`


## Important

All provided scripts will be executed with **root** permissions.
6 changes: 6 additions & 0 deletions cfg/php-startup-5.4/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
13 changes: 13 additions & 0 deletions cfg/php-startup-5.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom startup scripts

Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.

A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`


## Important

All provided scripts will be executed with **root** permissions.
6 changes: 6 additions & 0 deletions cfg/php-startup-5.5/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
13 changes: 13 additions & 0 deletions cfg/php-startup-5.5/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom startup scripts

Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.

A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`


## Important

All provided scripts will be executed with **root** permissions.
6 changes: 6 additions & 0 deletions cfg/php-startup-5.6/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
13 changes: 13 additions & 0 deletions cfg/php-startup-5.6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom startup scripts

Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.

A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`


## Important

All provided scripts will be executed with **root** permissions.
6 changes: 6 additions & 0 deletions cfg/php-startup-7.0/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
55 changes: 55 additions & 0 deletions cfg/php-startup-7.0/02-ms-odbc-driver.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
#
# This script will automatically install the Microsoft ODBC driver for MsSQL
# support for PHP during startup.
#
# In order for it to work, you must read and accept their License/EULA:
# https://odbceula.blob.core.windows.net/eula17/LICENSE172.TXT
#


# ------------------------------------------------------------------------------------------------
# EDIT THE VARIABLE BELOW TO ACCEPT THE EULA (If you agree to their terms)
# ------------------------------------------------------------------------------------------------

###
### Set this to "Y" (capital 'Y') if you accept the EULA.
###
ACCEPT_EULA=N



# ------------------------------------------------------------------------------------------------
# DO NOT EDIT BELOW THIS LINE
# ------------------------------------------------------------------------------------------------

###
### Where to retrieve the deb package
###
MSODBC_URL="https://packages.microsoft.com/debian/8/prod/pool/main/m/msodbcsql17/"


###
### Pre-flight check
###
if [ "${ACCEPT_EULA}" != "Y" ]; then
echo "MS ODBC EULA not accepted. Aborting installation."
exit 0
fi


###
### EULA accepted, so we can proceed
###

# Extract latest *.deb packate
MSODBC_DEB="$( curl -k -sS "${MSODBC_URL}" | grep -Eo 'msodbcsql[-._0-9]+?_amd64\.deb' | tail -1 )"

# Download to temporary location
curl -k -sS "${MSODBC_URL}${MSODBC_DEB}" > "/tmp/${MSODBC_DEB}"

# Install
ACCEPT_EULA="${ACCEPT_EULA}" dpkg -i "/tmp/${MSODBC_DEB}"

# Remove artifacts
rm -f "/tmp/${MSODBC_DEB}"
39 changes: 39 additions & 0 deletions cfg/php-startup-7.0/03-oracle-oci8-and-pdo_oci.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/
#

#curl -sS http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 2>/dev/null | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -

# Install 'alien' to install rpm packages
apt-get update -q
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests alien

# Instantclient (basic lite)
curl -o /tmp/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm

# Instantclient (devel)
curl -o /tmp/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm

# Install RPMs
alien -i /tmp/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm
alien -i /tmp/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm

# Rempve RPMs
rm -f /tmp/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm
rm -f /tmp/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm

# Necessary symlinks
ln -s /usr/lib/oracle/18.3/client64/lib/libmql1.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libipc1.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libnnz18.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libons.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libclntshcore.so.18.1 /usr/lib/

# Build and install PHP extension oci8
docker-php-ext-configure oci8 --with-oci8=instantclient
docker-php-ext-install oci8

# Build and install PHP extension pdo_oci
docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/usr,18.3
docker-php-ext-install pdo_oci
13 changes: 13 additions & 0 deletions cfg/php-startup-7.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom startup scripts

Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.

A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`


## Important

All provided scripts will be executed with **root** permissions.
6 changes: 6 additions & 0 deletions cfg/php-startup-7.1/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
55 changes: 55 additions & 0 deletions cfg/php-startup-7.1/02-ms-odbc-driver.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
#
# This script will automatically install the Microsoft ODBC driver for MsSQL
# support for PHP during startup.
#
# In order for it to work, you must read and accept their License/EULA:
# https://odbceula.blob.core.windows.net/eula17/LICENSE172.TXT
#


# ------------------------------------------------------------------------------------------------
# EDIT THE VARIABLE BELOW TO ACCEPT THE EULA (If you agree to their terms)
# ------------------------------------------------------------------------------------------------

###
### Set this to "Y" (capital 'Y') if you accept the EULA.
###
ACCEPT_EULA=N



# ------------------------------------------------------------------------------------------------
# DO NOT EDIT BELOW THIS LINE
# ------------------------------------------------------------------------------------------------

###
### Where to retrieve the deb package
###
MSODBC_URL="https://packages.microsoft.com/debian/8/prod/pool/main/m/msodbcsql17/"


###
### Pre-flight check
###
if [ "${ACCEPT_EULA}" != "Y" ]; then
echo "MS ODBC EULA not accepted. Aborting installation."
exit 0
fi


###
### EULA accepted, so we can proceed
###

# Extract latest *.deb packate
MSODBC_DEB="$( curl -k -sS "${MSODBC_URL}" | grep -Eo 'msodbcsql[-._0-9]+?_amd64\.deb' | tail -1 )"

# Download to temporary location
curl -k -sS "${MSODBC_URL}${MSODBC_DEB}" > "/tmp/${MSODBC_DEB}"

# Install
ACCEPT_EULA="${ACCEPT_EULA}" dpkg -i "/tmp/${MSODBC_DEB}"

# Remove artifacts
rm -f "/tmp/${MSODBC_DEB}"
39 changes: 39 additions & 0 deletions cfg/php-startup-7.1/03-oracle-oci8-and-pdo_oci.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/
#

#curl -sS http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 2>/dev/null | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -

# Install 'alien' to install rpm packages
apt-get update -q
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests alien

# Instantclient (basic lite)
curl -o /tmp/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm

# Instantclient (devel)
curl -o /tmp/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm

# Install RPMs
alien -i /tmp/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm
alien -i /tmp/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm

# Rempve RPMs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo in comment

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed it and will also test all available examples for validity during Travis CI run.

rm -f /tmp/oracle-instantclient18.3-basiclite-18.3.0.0.0-2.x86_64.rpm
rm -f /tmp/oracle-instantclient18.3-devel-18.3.0.0.0-2.x86_64.rpm

# Necessary symlinks
ln -s /usr/lib/oracle/18.3/client64/lib/libmql1.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libipc1.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libnnz18.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libons.so /usr/lib/
ln -s /usr/lib/oracle/18.3/client64/lib/libclntshcore.so.18.1 /usr/lib/

# Build and install PHP extension oci8
docker-php-ext-configure oci8 --with-oci8=instantclient
docker-php-ext-install oci8

# Build and install PHP extension pdo_oci
docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/usr,18.3
docker-php-ext-install pdo_oci
13 changes: 13 additions & 0 deletions cfg/php-startup-7.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom startup scripts

Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.

A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`


## Important

All provided scripts will be executed with **root** permissions.
6 changes: 6 additions & 0 deletions cfg/php-startup-7.2/01-update-apt-index.sh-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Simple example showing how to update the packet index
#

DEBIAN_FRONTEND=noninteractive apt-get update -q
Loading