Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:linkedin/indextank-service
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Perez committed Jan 18, 2012
2 parents 7605352 + 5319f32 commit 7177feb
Show file tree
Hide file tree
Showing 33 changed files with 326 additions and 242 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -20,7 +20,7 @@ Apache Public License (APL) 2.0

### Dependencies:

* Django tested with 1.2.7
* Django 1.2.x ( tested with 1.2.7, not compatible with 1.3.x )
* Python tested with 2.6.6
* Java(TM) SE Runtime Environment tested with build 1.6.0_24-b07
* nginx
Expand Down
2 changes: 0 additions & 2 deletions api/amazon_credential.py

This file was deleted.

2 changes: 1 addition & 1 deletion api/dostartapi.sh
Expand Up @@ -10,6 +10,6 @@ echo "######################## START API "`date`" ##########################" >

export PYTHONPATH=.:..

nohup uwsgi-python2.6 -C -s /var/nginx/api-uwsgi.sock -i -M -w wsgi -z 30 -p 150 -l 50 -L -R 10000 -b 8192 --no-orphans --pidfile pid 2>$ERRORLOG | $TEE | $ROTATELOG &
nohup uwsgi_python -C -s /var/nginx/api-uwsgi.sock -i -M -z 30 -p 150 -l 50 -L -R 10000 -b 8192 --no-orphans --pidfile pid 2>$ERRORLOG | $TEE | $ROTATELOG &


8 changes: 4 additions & 4 deletions api/settings.py
Expand Up @@ -76,12 +76,12 @@

EMAIL_HOST='localhost'
EMAIL_PORT=25
EMAIL_HOST_USER='email%localhost'
EMAIL_HOST_USER='user%localhost'
EMAIL_HOST_PASSWORD='****'

# Seeds for the api key generation. These are examples, they should be changed at each installation.
# You can find good seeds at https://www.grc.com/passwords.htm
APIKEY_KEY='BB20B26D35578F0CD53B1F9F270DEC2410F1BA90FB1BADCC3D79875DEC534C04'
ONETIMEPASS_KEY='86CB9927F58AE49255935D50CE4D372E57873D8C83B4B68E71818C7316D7F14D'
FORGOTPASS_KEY='42015FF556615CD6A9FB6884EB4B360CAE118B27E8597B4A1AF435DB703784E3'
APIKEY_KEY='5AD2CFAEEFAA93EC114DB414D7C3C18BBFB591784729DA33B2D779E65DB65DA5'
ONETIMEPASS_KEY='AC031B479497B86321EAC0E2D66A5A9C6EC6B4F891174E8016420DA1B9CC3320'
FORGOTPASS_KEY='2455B8EFEBBED1367A4DC2B732DBF08EF6BA5E009CC9C97A192C2C442BDD091A'

107 changes: 0 additions & 107 deletions api/storage.py

This file was deleted.

2 changes: 0 additions & 2 deletions backoffice/amazon_credential.py

This file was deleted.

6 changes: 3 additions & 3 deletions backoffice/settings.py
Expand Up @@ -87,7 +87,7 @@

# Seeds for the api key generation. These are examples, they should be changed at each installation.
# You can find good seeds at https://www.grc.com/passwords.htm
APIKEY_KEY='BB20B26D35578F0CD53B1F9F270DEC2410F1BA90FB1BADCC3D79875DEC534C04'
ONETIMEPASS_KEY='86CB9927F58AE49255935D50CE4D372E57873D8C83B4B68E71818C7316D7F14D'
FORGOTPASS_KEY='42015FF556615CD6A9FB6884EB4B360CAE118B27E8597B4A1AF435DB703784E3'
APIKEY_KEY='5AD2CFAEEFAA93EC114DB414D7C3C18BBFB591784729DA33B2D779E65DB65DA5'
ONETIMEPASS_KEY='AC031B479497B86321EAC0E2D66A5A9C6EC6B4F891174E8016420DA1B9CC3320'
FORGOTPASS_KEY='2455B8EFEBBED1367A4DC2B732DBF08EF6BA5E009CC9C97A192C2C442BDD091A'

1 change: 0 additions & 1 deletion nebu/controller.py
Expand Up @@ -4,7 +4,6 @@
import os
import signal
import systemutils
import subprocess

import flaptor.indextank.rpc.Controller as TController
from flaptor.indextank.rpc.ttypes import WorkerMountStats, WorkerLoadStats, IndexStats
Expand Down
35 changes: 35 additions & 0 deletions nebu/sample-config/etc/init.d/indexengine-nebu-controller
@@ -0,0 +1,35 @@
#! /bin/sh

PATH=.:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=indexengine-nebu-controller

. /lib/lsb/init-functions

case "$1" in
start)
log_daemon_msg "Starting" "$NAME"
svc -u /etc/service/$NAME
log_end_msg $?
;;
stop)
cd $APP_DIR
log_daemon_msg "Stopping" "$NAME"
svc -d /etc/service/$NAME
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting" "$NAME"
svc -t /etc/service/$NAME
log_end_msg $?
;;
status)
svok /etc/service/$NAME
log_end_msg $?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|status}" >&2
exit 1
;;
esac

12 changes: 12 additions & 0 deletions nebu/sample-config/etc/rc.local
@@ -0,0 +1,12 @@
if [ ! -d /mnt/logs/controller ]; then
rm -fr /etc/service/indexengine-nebu-controller/log/main
mkdir -p /mnt/logs/controller /mnt/indexes
ln -s /mnt/logs/controller /etc/service/indexengine-nebu-controller/log/main
echo PROD >/mnt/env.name
chown -R indextank:indextank /mnt
ln -s /mnt /data
fi

/usr/bin/svscanboot &
exit 0

@@ -0,0 +1,8 @@
#!/bin/bash
cd /home/indextank/nebu

echo "Supervise starting controller"
# start a local controller
exec sudo -u indextank DJANGO_SETTINGS_MODULE=settings PYTHONPATH=../ /usr/bin/python controller.py 2>&1
echo "Supervise (controller) ending"

6 changes: 3 additions & 3 deletions nebu/settings.py
Expand Up @@ -75,7 +75,7 @@

# Seeds for the api key generation. These are examples, they should be changed at each installation.
# You can find good seeds at https://www.grc.com/passwords.htm
APIKEY_KEY='BB20B26D35578F0CD53B1F9F270DEC2410F1BA90FB1BADCC3D79875DEC534C04'
ONETIMEPASS_KEY='86CB9927F58AE49255935D50CE4D372E57873D8C83B4B68E71818C7316D7F14D'
FORGOTPASS_KEY='42015FF556615CD6A9FB6884EB4B360CAE118B27E8597B4A1AF435DB703784E3'
APIKEY_KEY='5AD2CFAEEFAA93EC114DB414D7C3C18BBFB591784729DA33B2D779E65DB65DA5'
ONETIMEPASS_KEY='AC031B479497B86321EAC0E2D66A5A9C6EC6B4F891174E8016420DA1B9CC3320'
FORGOTPASS_KEY='2455B8EFEBBED1367A4DC2B732DBF08EF6BA5E009CC9C97A192C2C442BDD091A'

11 changes: 11 additions & 0 deletions sample-config/etc/hosts
@@ -0,0 +1,11 @@
127.0.0.1 localhost

127.0.0.1 database api storage deploymanager workermanager fend

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
25 changes: 25 additions & 0 deletions sample-config/etc/nginx/sites-available/api-uwsgi.conf
@@ -0,0 +1,25 @@
upstream api {
ip_hash;
server unix:/var/nginx/api-uwsgi.sock;
}

server {
listen 80;
listen 443 default ssl;
server_name *.api.indextank.com;
client_max_body_size 20m;

location / {
limit_conn one 45;
uwsgi_pass api;
include uwsgi_params;
}

error_page 411 = @empty_body;

location @empty_body {
uwsgi_pass api;
include uwsgi_params;
}
}

16 changes: 16 additions & 0 deletions sample-config/etc/nginx/sites-available/backoffice_fcgi.conf
@@ -0,0 +1,16 @@
server {
listen 80;
server_name backoffice.indextank.com;
client_max_body_size 1m;

location / {
fastcgi_pass 127.0.0.1:4200;
include fastcgi_params;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

47 changes: 47 additions & 0 deletions sample-config/etc/nginx/sites-available/storefront_fcgi.conf
@@ -0,0 +1,47 @@
server {
listen 80;
server_name indextank.com www.indextank.com;
client_max_body_size 1m;

location / {
fastcgi_pass 127.0.0.1:4300;
include fastcgi_params;
}

location /_static {
expires 24h;
autoindex on;
alias /home/indextank/storefront/static/;
}

location /nginx_status {
stub_status on;
access_log off;
deny all;
allow 127.0.0.1;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

server {
listen 443;
ssl on;
server_name indextank.com www.indextank.com;
client_max_body_size 1m;

location / {
fastcgi_pass 127.0.0.1:4300;
include fastcgi_params;
fastcgi_param HTTPS on;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

1 change: 1 addition & 0 deletions sample-config/etc/nginx/sites-enabled/api-uwsgi.conf
1 change: 1 addition & 0 deletions sample-config/etc/nginx/sites-enabled/backoffice_fcgi.conf
1 change: 1 addition & 0 deletions sample-config/etc/nginx/sites-enabled/storefront_fcgi.conf
18 changes: 18 additions & 0 deletions sample-config/etc/rc.local
@@ -0,0 +1,18 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

rm -fr /mnt/lost+found/
mkdir -p /data/pids /data/bkp /data/logs/api-rot
echo PROD >/data/env.name
chown -R indextank:indextank /mnt
exit 0

0 comments on commit 7177feb

Please sign in to comment.