Skip to content

Commit

Permalink
First commit, works with Wheezy64
Browse files Browse the repository at this point in the history
  • Loading branch information
systemz committed Sep 13, 2015
0 parents commit 81e3045
Show file tree
Hide file tree
Showing 11 changed files with 257 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.vagrant/
/build/
18 changes: 18 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
vagrant destroy -f wheezy64build
vagrant up wheezy64build
vagrant destroy -f wheezy64build
32 changes: 32 additions & 0 deletions build_pkg.sh
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>" \
--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
#
7 changes: 7 additions & 0 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -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=.
9 changes: 9 additions & 0 deletions nbproject/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>aimpanel-nginx</name>
</data>
</configuration>
</project>
9 changes: 9 additions & 0 deletions wheezy64/afterinstall
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions wheezy64/beforeinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
getent passwd aimpanel > /dev/null
if [ $? -eq 0 ]; then
echo ""
else
useradd -r -s /bin/false aimpanel
fi
25 changes: 25 additions & 0 deletions wheezy64/build.sh
Original file line number Diff line number Diff line change
@@ -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/
103 changes: 103 additions & 0 deletions wheezy64/etc/init.d/aimpanel-nginx
Original file line number Diff line number Diff line change
@@ -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

41 changes: 41 additions & 0 deletions wheezy64/usr/local/aimpanel/libs/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

0 comments on commit 81e3045

Please sign in to comment.