Skip to content

Instantly share code, notes, and snippets.

@dirkk0
Created November 27, 2013 08:00
Show Gist options
  • Save dirkk0/7672152 to your computer and use it in GitHub Desktop.
Save dirkk0/7672152 to your computer and use it in GitHub Desktop.
Setting up 'Lords Of Pomelo' (example game of multi-player engine pomelo) on Amazon EC2/Ubuntu 12.0.4
sudo apt-get update
# get ec2 ip and hostname
curl http://169.254.169.254/latest/meta-data/public-ipv4 > public.ip
curl http://169.254.169.254/latest/meta-data/public-hostname > public.hostname
echo 'colorscheme blue' > .vimrc
sudo apt-get install --yes build-essential curl git
#install latest node
sudo apt-get install --yes build-essential python-software-properties python g++ make
sudo add-apt-repository --yes ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install --yes nodejs
sudo apt-get install --yes sysstat
sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password secret-password'
sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password secret-password'
sudo apt-get -y install mysql-server
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/dbconfig-install boolean false'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/app-password-confirm password secret-password'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/admin-pass password secret-password'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/app-pass password secret-password'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2'
sudo apt-get install -y phpmyadmin
sudo service apache2 restart
sudo npm install -g pomelo
sudo npm install -g pomelo-cli
git clone https://github.com/NetEase/lordofpomelo.git
cd lordofpomelo; sudo sh npm-install.sh; cd ..;
mysql -u root -psecret-password -Bse "create database Pomelo;use Pomelo;source ./lordofpomelo/game-server/config/schema/Pomelo.sql;"
# vi ./shared/config/mysql.json
sed -e "s/xy/root/g" lordofpomelo/shared/config/mysql.json> temp && mv temp lordofpomelo/shared/config/mysql.json
sed -e "s/\"dev\"/\"secret-password\"/g" lordofpomelo/shared/config/mysql.json> temp && mv temp lordofpomelo/shared/config/mysql.json
sed -e "s/3001/8000/g" lordofpomelo/web-server/app.js> temp && mv temp lordofpomelo/web-server/app.js
# -- START
screen -S gameserver -L -dm bash -c "cd ~/lordofpomelo/game-server/; sudo pomelo start"
screen -S webserver -L -dm bash -c "cd ~/lordofpomelo/web-server/; sudo node app"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment