Commit b27c4c3a89691dd432b1c53cf2a15180c99655e5
1 parent
ce069c93
Exists in
master
and in
1 other branch
server config templates
Showing
4 changed files
with
141 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
1 | +DocumentRoot "/opt/pairwise-api/public" | ||
2 | +<Directory "/opt/pairwise-api/public"> | ||
3 | + Options FollowSymLinks -Indexes | ||
4 | + AllowOverride None | ||
5 | + Order Allow,Deny | ||
6 | + Allow from all | ||
7 | +</Directory> | ||
8 | + | ||
9 | +RewriteEngine On | ||
10 | + | ||
11 | +# Rewrite index to check for static index.html | ||
12 | +RewriteRule ^/$ /index.html [QSA] | ||
13 | + | ||
14 | +# Rewrite to check for Rails cached page | ||
15 | +RewriteRule ^([^.]+)$ $1.html [QSA] | ||
16 | + | ||
17 | +RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | ||
18 | +RewriteRule ^.*$ balancer://pairwise%{REQUEST_URI} [P,QSA,L] | ||
19 | + | ||
20 | +ErrorDocument 503 /503.html | ||
21 | + | ||
22 | +ErrorLog /var/log/apache2/pairwise.log | ||
23 | +LogLevel warn | ||
24 | +CustomLog /var/log/apache2/pairwise.access.log vhost_combined | ||
25 | + | ||
26 | +# Compress outgoing text content | ||
27 | +AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript | ||
28 | + | ||
29 | +# Add Expires: header | ||
30 | +ExpiresActive On | ||
31 | +ExpiresByType text/css "access plus 1 month" | ||
32 | +ExpiresByType application/javascript "access plus 1 month" | ||
33 | +ExpiresByType image/png "access plus 1 month" | ||
34 | +ExpiresByType image/gif "access plus 1 month" | ||
35 | +ExpiresByType image/jpeg "access plus 1 month" | ||
36 | +ExpiresByType image/x-icon "access plus 1 month" | ||
37 | + |
@@ -0,0 +1,97 @@ | @@ -0,0 +1,97 @@ | ||
1 | +#! /bin/sh | ||
2 | +### BEGIN INIT INFO | ||
3 | +# Provides: pairwise | ||
4 | +# Required-Start: $remote_fs | ||
5 | +# Required-Stop: $remote_fs | ||
6 | +# Default-Start: 2 3 4 5 | ||
7 | +# Default-Stop: 0 1 6 | ||
8 | +# Short-Description: Example initscript | ||
9 | +# Description: This file should be used to construct scripts to be | ||
10 | +# placed in /etc/init.d. | ||
11 | +### END INIT INFO | ||
12 | + | ||
13 | +# Sample init.d script for pairwise. | ||
14 | +# | ||
15 | +PATH=/sbin:/usr/sbin:/bin:/usr/bin | ||
16 | +DESC="Pairwise web platform" | ||
17 | +NAME=pairwise | ||
18 | +SCRIPTNAME=/etc/init.d/$NAME | ||
19 | + | ||
20 | +# default values | ||
21 | +PAIRWISE_DIR=/opt/pairwise-api/ | ||
22 | +PAIRWISE_USER=pairwise | ||
23 | + | ||
24 | +# Read configuration variable file if it is present | ||
25 | +#[ -r /etc/default/$NAME ] && . /etc/default/$NAME | ||
26 | + | ||
27 | +# Load the VERBOSE setting and other rcS variables | ||
28 | +. /lib/init/vars.sh | ||
29 | + | ||
30 | +if [ -z "$PAIRWISE_DIR" ] || [ -z "$PAIRWISE_USER" ]; then | ||
31 | + echo "PAIRWISE_DIR or PAIRWISE_USER not defined, noosfero not being started." | ||
32 | + echo "Both variables must be defined in /etc/default/pairwise" | ||
33 | + exit 0 | ||
34 | +fi | ||
35 | + | ||
36 | +#if test -x /usr/sbin/pairwise-check-dbconfig ; then | ||
37 | +# if ! pairwise-check-dbconfig; then | ||
38 | +# echo "Pairwise database access not configured, service disabled." | ||
39 | +# exit 0 | ||
40 | +# fi | ||
41 | +#fi | ||
42 | + | ||
43 | +###################### | ||
44 | + | ||
45 | +main_script() { | ||
46 | + cd $PAIRWISE_DIR | ||
47 | + #if [ "$PAIRWISE_USER" != "$USER" ]; then | ||
48 | + # su $PAIRWISE_USER -l -c "./script/production $1" | ||
49 | + #else | ||
50 | + bundle exec thin -C thin.yml $1 | ||
51 | + #fi | ||
52 | +} | ||
53 | + | ||
54 | +#do_setup() { | ||
55 | + | ||
56 | +#} | ||
57 | + | ||
58 | +do_start() { | ||
59 | + #if ! running; then | ||
60 | + #do_setup | ||
61 | + # actually start the service | ||
62 | + main_script start | ||
63 | + #else | ||
64 | + # echo 'Pairwise is already running, nothing to do...' | ||
65 | + #fi | ||
66 | +} | ||
67 | + | ||
68 | +do_stop() { | ||
69 | + #if running; then | ||
70 | + main_script stop | ||
71 | + #else | ||
72 | + # echo 'Pairwise is already stopped, nothing to do...' | ||
73 | + #fi | ||
74 | +} | ||
75 | + | ||
76 | +do_restart() { | ||
77 | + do_stop | ||
78 | + do_start | ||
79 | +} | ||
80 | + | ||
81 | +running(){ | ||
82 | + pgrep -f 'thin server (127.0.0.1:5030)' > /dev/null | ||
83 | +} | ||
84 | + | ||
85 | +case "$1" in | ||
86 | + start|stop|restart|setup) | ||
87 | + do_$1 | ||
88 | + ;; | ||
89 | + force-reload) | ||
90 | + do_restart | ||
91 | + ;; | ||
92 | + *) | ||
93 | + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|setup}" >&2 | ||
94 | + exit 3 | ||
95 | + ;; | ||
96 | +esac | ||
97 | + |
thin.yml
@@ -8,7 +8,8 @@ log: log/thin.log | @@ -8,7 +8,8 @@ log: log/thin.log | ||
8 | max_conns: 1024 | 8 | max_conns: 1024 |
9 | require: [] | 9 | require: [] |
10 | 10 | ||
11 | -environment: production | 11 | +environment: production |
12 | max_persistent_conns: 512 | 12 | max_persistent_conns: 512 |
13 | servers: 4 | 13 | servers: 4 |
14 | daemonize: true | 14 | daemonize: true |
15 | + |