This wiki introduces how to install our luna server. and this might turn into a script into git server. The target server must be connected internet. ==Installing system/ruby and all other shit==
 #!/bin/sh

 #system 
 apt-get -y install lynx-cur p7zip-full aptitude htop vim build-essential ethtool lm-sensors sshfs  iftop iotop smartmontools curl git git-core openssl bonnie++ autossh sysv-rc-conf byobu openvpn
 apt-get -y install postgresql-9.1 libpq-dev imagemagick graphicsmagick libcurl4-openssl-dev libmagickcore-dev libmagickwand-dev nodejs
 apt-get -y install bison libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libsqlite3-dev libmysqlclient-dev ttf-unifont libsasl2-dev libncurses5-dev
 apt-get -y install rabbitmq-server avahi-utils nginx
 apt-get -y install nodejs

 #ruby (dl from own mirror and compile)
 wget http://ca2.piza.cc/ruby-1.9.3-p327.tar.bz2
 tar xvfj ruby-1.9.3-p327.tar.bz2
 cd ruby-1.9.3-p327
 ./configure
 make & make install 
 gem install bundler


 #rails -> key and git clone
 mkdir -p /www
 cd /www
 git clone git@g77k.com:luna-server.git
 cd luna-server
 bundle install --without development:test
 rm Gemfile.lock #might need for successfully install gems.

 sudo -u postgres psql -c "create user luna with password 'luna';"
 sudo -u postgres psql -c "create database luna_production owner luna;"
 chmod -R a+w /etc/avahi/services
 rake db:migrate
 rake db:seed
 rake assets:precompile

 #setup thin
 thin install
 thin config -C /etc/thin/luna-server.yml -c /www/luna-server -e production -l /var/log/luna-server.log -s 2 -P /var/run/luna-server.pid
 #TODO edit init.d for autostart

 #hoge

 

== Install monitorix == See [[Monitorix]] for detail ==confs== ===luna-server /etc/nginx/site-enabled/luna-server===
upstream lunaserver {
    server localhost:3000;
    server localhost:3001;
}

server {
    listen 80;
    root /www/luna-server/public;

    # individual nginx logs for this lunaserver vhost
    access_log  /var/log/nginx/lunaserver_access.log;
    error_log   /var/log/nginx/lunaserver_error.log;

   location / {
     try_files $uri @lunaserver;
   }

   location  @lunaserver {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_set_header X-Forwarded-Proto https;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    client_max_body_size 16M;
    client_body_buffer_size 256K;
    proxy_pass http://lunaserver;
   }
}
==Installing for luna-server==

bundle
rake db:migrate
rake db:seed
(sudo chmod 777 /etc/avahi/services)
bundle exec rails s

Install postgre, please see [[Installing Postgresql]]
Install rabbitmq/erlang, please see
sudo apt-get install erlang

http://www.rabbitmq.com/install-debian.html,

Instaling rails 4.0 (ref:https://gist.github.com/2515536)
git clone https://github.com/rails/rails.git
gem install thor
(running hoge, please go into hoge directory, and puma -p 9090 -e production)
== installing for luna-scripts==
git clone git@g77k.com:luna-scripts.git
cd xml_curl
bundle
== Running for luna-scripts == (Please make sure you are in dir xml_curl)
ruby xml_curl_directory.rb
(if you are want to enable test user, from 0000-0010), you can
ENABLE_TEST_USER=1 ruby xml_curl_directory.rb 
== Notes for Requirement of Running luna-scripts == it needs port 8080, only access from freeswitch inside, no need to open to outside. == freeswitch == * [http://w.g77k.com/Build/Install_Freeswitch installed from source] == Hoge(Our Live Streaming Server) ==
git clone git@g77k.com:hoge.git
bundle
== Running for Hoge ==
puma -p 9090 -e production
== Notes for Requirement of Running luna-scripts == It needs port 9090, open to outside(because client needs this port open to sync/download media/music file) == Automatic fsck == Edit /etc/default/rcS, change FSCKFIX=no to FSCKFIX=yes (uncomment it if necessary). == Touchscreen calibrator ==

Install xinput-calibrator: sudo apt-get install xinput-calibrator

run xinput_calibrator, and calibrate the touchscreen, then you can get the result, paste the result into file /usr/share/X11/99-calibrator.conf. If you need swap X/Y axis or invert X/Y axis, and the lines you want:

Option "SwapAxes" "1"
Option "InvertX" "1"
Option "InvertY" "1"