Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #78 from niiknow/master
Browse files Browse the repository at this point in the history
add couchdb to init.d and iconcube loader
  • Loading branch information
noogen authored Apr 25, 2019
2 parents 95b608b + 03a076c commit 120297a
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
GOLANG_VERSION=1.12.4 \
NGINX_BUILD_DIR=/usr/src/nginx \
NGINX_DEVEL_KIT_VERSION=0.3.0 NGINX_SET_MISC_MODULE_VERSION=0.31 \
NGINX_VERSION=1.14.2 \
NGINX_VERSION=1.16.0 \
NGINX_PAGESPEED_VERSION=1.13.35.2 \
NGINX_PSOL_VERSION=1.13.35.2 \
IMAGE_FILTER_URL=https://raw.githubusercontent.com/niiknow/docker-nginx-image-proxy/master/build/src/ngx_http_image_filter_module.c
Expand Down Expand Up @@ -150,14 +150,19 @@ RUN cd /tmp \
COPY rootfs/. /

RUN cd /tmp \

# tweaks
&& chmod +x /etc/init.d/dovecot \
&& chmod +x /etc/service/sshd/run \
&& chmod +x /etc/init.d/mongod \
&& chmod +x /etc/my_init.d/startup.sh \
&& mv /sysprepz/admin/bin/vesta-*.sh /bin \

# install iconcube loader extension
&& /bin/vesta-ioncube-install.sh 7.1 \
&& /bin/vesta-ioncube-install.sh 7.2 \
&& /bin/vesta-ioncube-install.sh 7.3 \

# activate ini
&& echo "extension=v8js.so" > /etc/php/7.1/mods-available/v8js.ini \
&& ln -sf /etc/php/7.1/mods-available/v8js.ini /etc/php/7.1/apache2/conf.d/20-v8js.ini \
&& ln -sf /etc/php/7.1/mods-available/v8js.ini /etc/php/7.1/cli/conf.d/20-v8js.ini \
Expand Down
159 changes: 159 additions & 0 deletions rootfs/etc/init.d/couchdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#!/bin/sh -e

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

### BEGIN INIT INFO
# Provides: couchdb
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Apache CouchDB init script
# Description: Apache CouchDB init script for the database server.
### END INIT INFO

SCRIPT_OK=0
SCRIPT_ERROR=1

DESCRIPTION="database server"
NAME=couchdb
SCRIPT_NAME=`basename $0`
COUCHDB=/usr/local/bin/couchdb
CONFIGURATION_FILE=/usr/local/etc/default/couchdb
RUN_DIR=/usr/local/var/run/couchdb
LSB_LIBRARY=/lib/lsb/init-functions

if test ! -x $COUCHDB; then
exit $SCRIPT_ERROR
fi

if test -r $CONFIGURATION_FILE; then
. $CONFIGURATION_FILE
fi

log_daemon_msg () {
# Dummy function to be replaced by LSB library.

echo $@
}

log_end_msg () {
# Dummy function to be replaced by LSB library.

if test "$1" != "0"; then
echo "Error with $DESCRIPTION: $NAME"
fi
return $1
}

if test -r $LSB_LIBRARY; then
. $LSB_LIBRARY
fi

run_command () {
command="$1"
if test -n "$COUCHDB_OPTIONS"; then
command="$command $COUCHDB_OPTIONS"
fi
if test -n "$COUCHDB_USER"; then
if su $COUCHDB_USER -c "$command"; then
return $SCRIPT_OK
else
return $SCRIPT_ERROR
fi
else
if $command; then
return $SCRIPT_OK
else
return $SCRIPT_ERROR
fi
fi
}

start_couchdb () {
# Start Apache CouchDB as a background process.

mkdir -p "$RUN_DIR"
if test -n "$COUCHDB_USER"; then
chown $COUCHDB_USER "$RUN_DIR"
fi
command="$COUCHDB -b"
if test -n "$COUCHDB_STDOUT_FILE"; then
command="$command -o $COUCHDB_STDOUT_FILE"
fi
if test -n "$COUCHDB_STDERR_FILE"; then
command="$command -e $COUCHDB_STDERR_FILE"
fi
if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
fi
run_command "$command" > /dev/null
}

stop_couchdb () {
# Stop the running Apache CouchDB process.

run_command "$COUCHDB -d" > /dev/null
}

display_status () {
# Display the status of the running Apache CouchDB process.

run_command "$COUCHDB -s"
}

parse_script_option_list () {
# Parse arguments passed to the script and take appropriate action.

case "$1" in
start)
log_daemon_msg "Starting $DESCRIPTION" $NAME
if start_couchdb; then
log_end_msg $SCRIPT_OK
else
log_end_msg $SCRIPT_ERROR
fi
;;
stop)
log_daemon_msg "Stopping $DESCRIPTION" $NAME
if stop_couchdb; then
log_end_msg $SCRIPT_OK
else
log_end_msg $SCRIPT_ERROR
fi
;;
restart)
log_daemon_msg "Restarting $DESCRIPTION" $NAME
if stop_couchdb; then
if start_couchdb; then
log_end_msg $SCRIPT_OK
else
log_end_msg $SCRIPT_ERROR
fi
else
log_end_msg $SCRIPT_ERROR
fi
;;
status)
display_status
;;
*)
cat << EOF >&2
Usage: $SCRIPT_NAME {start|stop|restart|status}
EOF
exit $SCRIPT_ERROR
;;
esac
}

parse_script_option_list $@
53 changes: 53 additions & 0 deletions rootfs/sysprepz/admin/bin/vesta-ioncube-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# Color Reset
Color_Off='\033[0m' # Text Reset

# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Cyan='\033[0;36m' # Cyan

# PHP Version
PHP_VERSION="$1"

# PHP Modules folder
MODULES=$(php$PHP_VERSION -i | grep extension_dir | grep php | awk '{print $NF}')

# System Architecture
ARCH=$(getconf LONG_BIT)

getFiles() {
cd /tmp
if [ ! -f ioncube_loaders_lin_x86-64.tar.gz ]; then
# if machine type is 64-bit, download and extract 64-bit files
if [ $ARCH == 64 ]; then
echo -e "${Cyan} \n Downloading.. ${Color_Off}"
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

echo -e "${Cyan} Extracting files.. ${Color_Off}"
tar xvfz ioncube_loaders_lin_x86-64.tar.gz

# else, get 32-bit files
else
echo -e "${Cyan} \n Downloading.. ${Color_Off}"
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

echo -e "${Cyan} Extracting files.. ${Color_Off}"
tar xvfz ioncube_loaders_lin_x86.tar.gz
fi
fi

echo -e "${Cyan} \n Copying files to PHP Modules folder.. ${Color_Off}"
# Copy files to modules folder
sudo cp "ioncube/ioncube_loader_lin_${PHP_VERSION}.so" $MODULES
sudo cp "ioncube/ioncube_loader_lin_${PHP_VERSION}_ts.so" $MODULES
}

success() {
echo -e "${Green} \n IonCube for php${PHP_VERSION} has been installed. ${Color_Off}"
}

# RUN
getFiles
success

0 comments on commit 120297a

Please sign in to comment.