diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a52c960 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.vagrant/ +/build/ \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..843167a --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,18 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +#Copyright © 2015 Michał Frąckiewicz. All rights reserved. + +Vagrant.configure(2) do |config| + +#wheezy64build + config.vm.define "wheezy64build" do |wheezy64build| + wheezy64build.vm.box = "deb/wheezy-amd64" + wheezy64build.vm.provider "virtualbox" do |vb| + vb.memory = "2048" + vb.cpus = 7 + end + wheezy64build.vm.hostname = "wheezy64build.aimpanel.pro" + wheezy64build.vm.provision "shell", path: "wheezy64/build.sh" + end + +end diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..d26b3bb --- /dev/null +++ b/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +vagrant destroy -f wheezy64build +vagrant up wheezy64build +vagrant destroy -f wheezy64build \ No newline at end of file diff --git a/build_pkg.sh b/build_pkg.sh new file mode 100755 index 0000000..4ad1ec2 --- /dev/null +++ b/build_pkg.sh @@ -0,0 +1,32 @@ +#!/bin/bash +[ -z "$1" ] && echo "Provide version number like 1.0" >&2 && exit 1 +set -e + +# +# wheezy64 +# +mkdir -p build/wheezy64/etc/init.d/ +rsync -rv wheezy64/ build/wheezy64/ + +cd build/wheezy64 + +fpm -s dir -t deb \ + --version $1 \ + --name "aimpanel-nginx" \ + --description "Easy to use control panel for game servers - integrated high performance nginx WWW server" \ + --url "https://lvlup.pro" \ + --vendor "LVL UP" \ + -m "Michał Frąckiewicz " \ + --license "All rights reserved" \ + --before-install beforeinstall \ + --after-install afterinstall \ + -d aimpanel-php \ + usr etc + +#sign that package +dpkg-sig --sign builder *.deb +cd - + +# +# jessie64 +# \ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..76f6f91 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_56 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=false +web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..f08bac2 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + aimpanel-nginx + + + diff --git a/wheezy64/afterinstall b/wheezy64/afterinstall new file mode 100644 index 0000000..ae4ea38 --- /dev/null +++ b/wheezy64/afterinstall @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /usr/local/aimpanel/run/ +chmod -R 750 /usr/local/aimpanel/ +chown -R aimpanel:aimpanel /usr/local/aimpanel/ +chmod 755 /etc/init.d/aimpanel-nginx +if [ -x "/etc/init.d/aimpanel-nginx" ]; then + update-rc.d aimpanel-nginx defaults >/dev/null || exit $? +fi +service aimpanel-nginx restart diff --git a/wheezy64/beforeinstall b/wheezy64/beforeinstall new file mode 100644 index 0000000..0564d25 --- /dev/null +++ b/wheezy64/beforeinstall @@ -0,0 +1,7 @@ +#!/bin/bash +getent passwd aimpanel > /dev/null +if [ $? -eq 0 ]; then + echo "" +else + useradd -r -s /bin/false aimpanel +fi diff --git a/wheezy64/build.sh b/wheezy64/build.sh new file mode 100644 index 0000000..fe60aeb --- /dev/null +++ b/wheezy64/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e +MAKE_THREADS=7 + +#update repo +apt-get update + +##Build nginx on debian wheezy, ubuntu trusty +apt-get install -y build-essential rsync libpcre3-dev +NGINX_FILENAME="nginx-1.8.0" +TEMP_DIR="/tmp/aimpanel_setup" +mkdir -p $TEMP_DIR/nginx +mkdir -p /usr/local/aimpanel/libs/nginx/conf/ +mkdir -p /usr/local/aimpanel/run/ +wget http://nginx.org/download/$NGINX_FILENAME.tar.gz -O $TEMP_DIR/$NGINX_FILENAME.tar.gz +tar -xf $TEMP_DIR/$NGINX_FILENAME.tar.gz -C $TEMP_DIR/nginx +cd $TEMP_DIR/nginx/$NGINX_FILENAME +./configure --prefix=/usr/local/aimpanel/libs/nginx \ + --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module \ + --user=aimpanel --group=aimpanel +make -j $MAKE_THREADS +make install + +mkdir -p /vagrant/build/wheezy64/usr/local/aimpanel/libs/nginx/conf +rsync -rv --delete /usr/local/aimpanel/libs/nginx/ /vagrant/build/wheezy64/usr/local/aimpanel/libs/nginx/ \ No newline at end of file diff --git a/wheezy64/etc/init.d/aimpanel-nginx b/wheezy64/etc/init.d/aimpanel-nginx new file mode 100644 index 0000000..609b319 --- /dev/null +++ b/wheezy64/etc/init.d/aimpanel-nginx @@ -0,0 +1,103 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: aimpanel-nginx +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Stop: $local_fs $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts the nginx web server +# Description: starts nginx using start-stop-daemon +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/local/aimpanel/libs/nginx/sbin/nginx +NAME=aimpanel-nginx +DESC=aimpanel-nginx +PIDFILE=/usr/local/aimpanel/run/nginx.pid + +# Include nginx defaults if available +#if [ -f /etc/default/nginx ]; then +# . /etc/default/nginx +#fi + +test -x $DAEMON || exit 0 + +set -e + +. /lib/lsb/init-functions + +test_nginx_config() { + if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1; then + return 0 + else + $DAEMON -t $DAEMON_OPTS + return $? + fi +} + +case "$1" in + start) + echo -n "Starting $DESC: " + test_nginx_config + # Check if the ULIMIT is set in /etc/default/nginx + #if [ -n "$ULIMIT" ]; then + # Set the ulimits + # ulimit $ULIMIT + #fi + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $DAEMON_OPTS || true + echo "$NAME." + ;; + + stop) + echo -n "Stopping $DESC: " + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON || true + echo "$NAME." + ;; + + restart|force-reload) + echo -n "Restarting $DESC: " + start-stop-daemon --stop --quiet --pidfile \ + $PIDFILE --exec $DAEMON || true + sleep 1 + test_nginx_config + # Check if the ULIMIT is set in /etc/default/nginx + if [ -n "$ULIMIT" ]; then + # Set the ulimits + ulimit $ULIMIT + fi + start-stop-daemon --start --quiet --pidfile \ + $PIDFILE --exec $DAEMON -- $DAEMON_OPTS || true + echo "$NAME." + ;; + + reload) + echo -n "Reloading $DESC configuration: " + test_nginx_config + start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE \ + --exec $DAEMON || true + echo "$NAME." + ;; + + configtest|testconfig) + echo -n "Testing $DESC configuration: " + if test_nginx_config; then + echo "$NAME." + else + exit $? + fi + ;; + + status) + status_of_proc -p $PIDFILE "$DAEMON" nginx && exit 0 || exit $? + ;; + *) + echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/wheezy64/usr/local/aimpanel/libs/nginx/conf/nginx.conf b/wheezy64/usr/local/aimpanel/libs/nginx/conf/nginx.conf new file mode 100644 index 0000000..0fa1213 --- /dev/null +++ b/wheezy64/usr/local/aimpanel/libs/nginx/conf/nginx.conf @@ -0,0 +1,41 @@ +user aimpanel; +worker_processes 1; +pid /usr/local/aimpanel/run/nginx.pid; + +events +{ + worker_connections 1024; +} +http +{ + server + { + listen 3131 default_server; + #listen [::]:3131 default_server ipv6only=on; + root /usr/local/aimpanel/app/public; + index index.php index.html index.htm; + server_name _; + #fixing virtualbox mount JS encoding problems + sendfile off; + location / { + include mime.types; + try_files $uri $uri/ /index.php?$query_string; + } + location ~ \.php$ { + # regex to split $uri to $fastcgi_script_name and $fastcgi_path + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # Check that the PHP script exists before passing it + try_files $fastcgi_script_name =404; + # Bypass the fact that try_files resets $fastcgi_path_info + # see: http://trac.nginx.org/nginx/ticket/321 + set $path_info $fastcgi_path_info; + fastcgi_param PATH_INFO $path_info; + fastcgi_index index.php; + include fastcgi.conf; + fastcgi_pass unix:/usr/local/aimpanel/run/php5-fpm.sock; + } + location ~ /\.ht { + deny all; + } + } +}