Permalink
Browse files

Merge branch 'master' of git://github.com/diginux/CEUG

  • Loading branch information...
2 parents 675c030 + c5da768 commit 4d635b94fd24b196fe5ee2666cd6e076bd61facd Tristan committed Sep 10, 2009
Showing with 124 additions and 6 deletions.
  1. +24 −0 README
  2. +22 −0 blog_db
  3. +4 −0 clear_db
  4. +3 −3 config/sys.config
  5. +5 −0 deploy
  6. +1 −1 lib/blog_db/ebin/blog_db.app
  7. +2 −2 lib/blog_db/src/db_connection_server.erl
  8. +5 −0 setup_db
  9. +58 −0 setup_node
View
24 README
@@ -0,0 +1,24 @@
+Install the following libraries:
+
+% sudo apt-get install erlang mysql
+
+*Note: Use temp4now as mysql server root password
+
+edit ~/.bashrc (both root and chatyeo user)
+export PATH=$PATH:/usr/local/erlware/bin
+export ERL_LIBS=/opt/erlang-libs/:/usr/lib/erlang/lib/:/usr/local/erlware/lib/
+
+source ~/.bashrc
+
+% wget http://faxien.googlecode.com/files/faxien-launcher-universal-0.3.4.py
+% sudo python faxien-launcher-universal-0.3.4.py
+(accept defaults, say (n)ew when asking about config files)
+
+% Setup yaws and other stuff
+
+% sudo ./setup_node
+
+Do the following each time you change the chatyeo code
+
+% ./deploy
+% ceug
View
22 blog_db
@@ -0,0 +1,22 @@
+create database blog;
+use blog;
+
+CREATE TABLE `posts` (
+ `title` char(200) NOT NULL,
+ `post` varchar(20000) NOT NULL,
+ `timestamp` datetime NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `users` (
+ `id` int(11) NOT NULL auto_increment,
+ `username` char(15) UNIQUE NOT NULL,
+ INDEX (`username`),
+ `fullname` char(255) NOT NULL,
+ `email` char(255) UNIQUE NOT NULL,
+ INDEX (`email`),
+ `password` char(41) NOT NULL,
+ `date_joined` date NOT NULL,
+ `last_logged_in` datetime NOT NULL,
+ `anon_username` char(15) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
View
4 clear_db
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+mysql -u root -ptemp4now < "drop database chatyeo;" &> /dev/null
+
View
6 config/sys.config
@@ -5,7 +5,7 @@
[
{sasl,
[
- {sasl_error_logger, {file, "/tmp/chatyeo.sasl_log"}}
+ {sasl_error_logger, {file, "/tmp/ceug.sasl_log"}}
]
},
@@ -18,7 +18,7 @@
{wiring, [
{elwrap, [
{wire, sasl, sasl_error_logger, "V:{sasl_error_logger, V}"},
- {err_log, "/tmp/chatyeo.err_log"},
+ {err_log, "/tmp/ceug.err_log"},
{err_log_wrap_info, {{err,5000000,10},{sasl,5000000,10}}},
{transform_previous, "V:[V]"}
]}
@@ -36,7 +36,7 @@
{port, 8000},
{session_timeout, 720},
{sign_key, "SIGN_KEY"},
- {wwwroot, "/home/tristan/Devel/ceug/lib/blog/wwwroot"}
+ {wwwroot, "/opt/ceug/wwwroot"}
]
}
].
View
5 deploy
@@ -5,3 +5,8 @@ echo Deploying CEUG Blog
/usr/local/erlware/bin/sinan dist
sudo /usr/local/erlware/bin/faxien ir _build/development/tar/ceug-0.1.0.0.tar.gz
+sudo mkdir /opt/ceug &> /dev/null
+
+sudo rm -fr /opt/ceug/wwwroot
+sudo cp -R lib/blog/wwwroot /opt/ceug/
+sudo ln -sf /opt/erlang-libs/nitrogen/www /opt/ceug/wwwroot/nitrogen
View
2 lib/blog_db/ebin/blog_db.app
@@ -10,6 +10,6 @@
]},
{registered,[blog_db_sup, p1]},
{applications, [kernel, stdlib, sasl, gas, mysql]},
- {mod, {chatyeo_db_app,[]}},
+ {mod, {blog_db_app,[]}},
{start_phases, []}]}.
View
4 lib/blog_db/src/db_connection_server.erl
@@ -19,8 +19,8 @@
-define(SERVER, ?MODULE).
-define(DB_SERVER, "localhost").
--define(CHATYEO_DB, "chatyeo").
--define(CHATYEO_DB_USER, "chatyeo").
+-define(CHATYEO_DB, "blog").
+-define(CHATYEO_DB_USER, "root").
-define(CHATYEO_DB_PASSWORD, "temp4now").
-record(state, {connections}).
View
5 setup_db
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+echo Setting up MySQL databases..
+
+mysql -u root -ptemp4now < blog_db
View
58 setup_node
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+## We assume for now erlang and faxien is already installed
+
+CWD=`pwd`
+
+## Make sure user has root perms
+
+ROOT_UID=0 # Only users with $UID 0 have root privileges.
+E_NOTROOT=67 # Non-root exit error.
+
+if [ $UID -ne $ROOT_UID ]
+then
+ echo "Must be root to run this script. Try sudo ./setup_node"
+ exit $E_NOTROOT
+fi
+
+## Install nitrogen
+
+if [ -d /opt/erlang-libs/nitrogen ]; then
+ echo "Nitrogen already installed"
+else
+ echo "Installing Nitrogen from github"
+ mkdir -p /opt/erlang-libs/
+ cd /opt/erlang-libs/
+ git clone git://github.com/diginux/nitrogen.git
+ cd nitrogen
+ make
+ cd $CWD
+fi
+
+## Install yaws
+
+if [ -d /opt/erlang-libs/yaws ]; then
+ echo "Yaws already installed"
+else
+ echo "Installing Yaws version 1.77"
+ mkdir -p /opt/erlang-libs
+ cd /opt/erlang-libs
+ wget http://yaws.hyber.org/download/yaws-1.77.tar.gz
+ tar zxvf yaws-1.77.tar.gz
+ cd yaws
+ ./configure
+ make
+ cd $CWD
+fi
+
+# Setup required apps for ceug
+
+echo Installing required apps for ceug
+
+echo Installing mysql app
+
+/usr/local/erlware/bin/faxien ia mysql
+
+echo Installing sinan
+
+/usr/local/erlware/bin/faxien ir sinan

0 comments on commit 4d635b9

Please sign in to comment.