From 0d92ff5fd34d79b54c30c38ac41bc600acf7b7c4 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 27 Oct 2013 15:14:18 +0100 Subject: o Dropping the CSV file for using a native app config file instead. o Using apache as an example app. o Adding appstore-add-app as a utility to register appliations. --- test/data/my-webapp/app.config | 3 +- test/data/my-webapp/root/bin/app.js | 39 --------------------- test/data/my-webapp/root/bin/my-app | 20 +++++++++++ test/data/my-webapp/root/conf/httpd.conf | 56 ++++++++++++++++++++++++++++++ test/data/my-webapp/root/conf/mime.types | 0 test/data/my-webapp/root/conf/modules.conf | 1 + test/data/my-webapp/root/conf/modules.load | 24 +++++++++++++ 7 files changed, 103 insertions(+), 40 deletions(-) delete mode 100755 test/data/my-webapp/root/bin/app.js create mode 100755 test/data/my-webapp/root/bin/my-app create mode 100644 test/data/my-webapp/root/conf/httpd.conf create mode 100644 test/data/my-webapp/root/conf/mime.types create mode 100644 test/data/my-webapp/root/conf/modules.conf create mode 100644 test/data/my-webapp/root/conf/modules.load (limited to 'test/data/my-webapp') diff --git a/test/data/my-webapp/app.config b/test/data/my-webapp/app.config index 40cbaa0..3a68978 100644 --- a/test/data/my-webapp/app.config +++ b/test/data/my-webapp/app.config @@ -1 +1,2 @@ -app.bin=app.js +app.pid_management=launcher +app.launch_timeout=2 diff --git a/test/data/my-webapp/root/bin/app.js b/test/data/my-webapp/root/bin/app.js deleted file mode 100755 index 992a701..0000000 --- a/test/data/my-webapp/root/bin/app.js +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env nodejs - -var http = require("http"), - url = require("url"), - path = require("path"), - fs = require("fs") - port = process.env.PORT || 8888; - -http.createServer(function(request, response) { - - var uri = url.parse(request.url).pathname - , filename = path.join(process.cwd(), uri); - - path.exists(filename, function(exists) { - if(!exists) { - response.writeHead(404, {"Content-Type": "text/plain"}); - response.write("404 Not Found\n"); - response.end(); - return; - } - - if (fs.statSync(filename).isDirectory()) filename += '/index.html'; - - fs.readFile(filename, "binary", function(err, file) { - if(err) { - response.writeHead(500, {"Content-Type": "text/plain"}); - response.write(err + "\n"); - response.end(); - return; - } - - response.writeHead(200); - response.write(file, "binary"); - response.end(); - }); - }); -}).listen(parseInt(port, 10)); - -console.log("Static file server running at\n => http://localhost:" + port + "/\nCTRL + C to shutdown"); diff --git a/test/data/my-webapp/root/bin/my-app b/test/data/my-webapp/root/bin/my-app new file mode 100755 index 0000000..e3fb305 --- /dev/null +++ b/test/data/my-webapp/root/bin/my-app @@ -0,0 +1,20 @@ +#!/bin/bash + +export BASEDIR=`pwd` + +exec 1>/tmp/stdout +exec 2>/tmp/stderr + +mkdir -p "$BASEDIR/locks" +mkdir -p "$BASEDIR/logs" + +set -x +export APACHE_LOCK_DIR="$BASEDIR/locks" +export APACHE_PID_FILE="$(cd $BASEDIR/../../../.app && pwd)/pid" +export APACHE_LOG_DIR="$BASEDIR/logs" + +export MODULES=/usr/lib/apache2/modules + +export PORT=$(app conf get myapp.port) + +exec /usr/sbin/apache2 -DPORT="$PORT" -f "$BASEDIR/conf/httpd.conf" diff --git a/test/data/my-webapp/root/conf/httpd.conf b/test/data/my-webapp/root/conf/httpd.conf new file mode 100644 index 0000000..4a1e775 --- /dev/null +++ b/test/data/my-webapp/root/conf/httpd.conf @@ -0,0 +1,56 @@ +ServerRoot ${BASEDIR} +Mutex file:locks default +PidFile ${APACHE_PID_FILE} +Timeout 300 +KeepAlive On +MaxKeepAliveRequests 100 +KeepAliveTimeout 5 + +#User ${APACHE_RUN_USER} +#Group ${APACHE_RUN_GROUP} + +HostnameLookups Off +ErrorLog logs/error.log +LogLevel warn + +Include conf/modules.load +Include conf/modules.conf + +Listen ${PORT} + + + StartServers 5 + MinSpareServers 5 + MaxSpareServers 10 + MaxRequestWorkers 150 + MaxConnectionsPerChild 0 + + + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + Options Indexes FollowSymLinks + AllowOverride None + Require all granted + + +AccessFileName .htaccess + + + Require all denied + + +LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined +LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %O" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent + +#IncludeOptional conf-enabled/*.conf +#IncludeOptional sites-enabled/*.conf + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/test/data/my-webapp/root/conf/mime.types b/test/data/my-webapp/root/conf/mime.types new file mode 100644 index 0000000..e69de29 diff --git a/test/data/my-webapp/root/conf/modules.conf b/test/data/my-webapp/root/conf/modules.conf new file mode 100644 index 0000000..f791286 --- /dev/null +++ b/test/data/my-webapp/root/conf/modules.conf @@ -0,0 +1 @@ +TypesConfig conf/mime.types diff --git a/test/data/my-webapp/root/conf/modules.load b/test/data/my-webapp/root/conf/modules.load new file mode 100644 index 0000000..eafc5b5 --- /dev/null +++ b/test/data/my-webapp/root/conf/modules.load @@ -0,0 +1,24 @@ +LoadModule access_compat_module /usr/lib/apache2/modules/mod_access_compat.so +LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so +LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so +LoadModule authn_core_module /usr/lib/apache2/modules/mod_authn_core.so +LoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so +LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so +LoadModule authz_groupfile_module /usr/lib/apache2/modules/mod_authz_groupfile.so +LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so +LoadModule authz_user_module /usr/lib/apache2/modules/mod_authz_user.so +LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so +LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so +LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so +LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so +LoadModule dnssd_module /usr/lib/apache2/modules/mod_dnssd.so +LoadModule env_module /usr/lib/apache2/modules/mod_env.so +LoadModule expires_module /usr/lib/apache2/modules/mod_expires.so +LoadModule filter_module /usr/lib/apache2/modules/mod_filter.so +LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so +LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so +LoadModule negotiation_module /usr/lib/apache2/modules/mod_negotiation.so +LoadModule php5_module /usr/lib/apache2/modules/libphp5.so +LoadModule reqtimeout_module /usr/lib/apache2/modules/mod_reqtimeout.so +LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so +LoadModule status_module /usr/lib/apache2/modules/mod_status.so -- cgit v1.2.3