Skip to content

Commit

Permalink
Travis CI setup freeciv#1.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasrosdal committed Mar 7, 2014
1 parent 42b6066 commit 2bd1036
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ compiler:
- gcc
before_install:
- pwd
- sudo apt-get update
- sudo apt-get install maven2 mysql-server-5.5 openjdk-7-jdk libcurl4-openssl-dev nginx libjansson-dev subversion pngcrush libtool automake autoconf autotools-dev language-pack-en python3-setuptools libglib2.0-dev


script: "sudo ./scripts/freeciv-web-bootstrap.sh"
script: "sudo ./scripts/freeciv-web-travis-setup.sh"


103 changes: 103 additions & 0 deletions scripts/freeciv-web-travis-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/bash

# Freeciv-web Vagrant Bootstrap Script - play.freeciv.org
# 2014-02-17 - Andreas Røsdal
#
# Setup script for Freeciv-web to be used on a Vagrant local developer image.
# This script assumes that the source code in git has been checked out from
# https://github.com/freeciv/freeciv-web to /vagrant

if [ -d "/vagrant/" ]; then
# script is run to install Freeciv-web under vagrant
basedir="/vagrant"
logfile="/vagrant/freeciv-web-vagrant.log"
else
# script is run to install Freeciv-web on current system without vagrant
echo "Installing Freeciv-web on current system. Please run this script as root user."
basedir=$(pwd)"/.."
logfile="${basedir}/freeciv-web-vagrant.log"
fi


# Redirect copy of output to a log file.
exec > >(tee ${logfile})
exec 2>&1
set -e

echo "================================="
echo "Running Freeciv-web setup script."
echo "================================="

uname -a
echo basedir $basedir
echo logfile $logfile

# User will need permissions to create a database
mysql_user="root"
mysql_pass="vagrant"

resin_version="4.0.38"
resin_url="http://www.caucho.com/download/resin-${resin_version}.tar.gz"
tornado_url="https://pypi.python.org/packages/source/t/tornado/tornado-3.2.tar.gz"

# Based on fresh install of Ubuntu 12.04
dependencies="maven2 mysql-server-5.5 openjdk-7-jdk libcurl4-openssl-dev nginx libjansson-dev subversion pngcrush libtool automake autoconf autotools-dev language-pack-en python3-setuptools libglib2.0-dev"

## Setup
mkdir -p ${basedir}
cd ${basedir}

## dependencies
echo "==== Installing Updates and Dependencies ===="
echo "apt-get update"
apt-get -y update
echo "mysql setup..."
sudo debconf-set-selections <<< "mysql-server-5.5 mysql-server/root_password password ${mysql_pass}"
sudo debconf-set-selections <<< "mysql-server-5.5 mysql-server/root_password_again password ${mysql_pass}"
echo "apt-get install dependencies"
apt-get -y install ${dependencies}

## build/install resin
echo "==== Fetching/Installing Resin ${resin_version} ===="
wget ${resin_url}
tar xvfz resin-${resin_version}.tar.gz
rm -Rf resin
mv resin-${resin_version} resin

echo "==== Fetching/Installing Tornado Web Server ===="
wget ${tornado_url}
tar xvfz tornado-3.2.tar.gz
cd tornado-3.2
python3.3 setup.py install


## mysql setup
echo "==== Setting up MySQL ===="
mysqladmin -u ${mysql_user} -p${mysql_pass} create freeciv_web
mysql -u ${mysql_user} -p${mysql_pass} freeciv_web < ${basedir}/freeciv-web/src/main/webapp/meta/private/metaserver.sql

echo "==== Building freeciv ===="
cd ${basedir}/freeciv && ./prepare_freeciv.sh
cd freeciv && make install
cd ${basedir}/freeciv/data/ && cp -rf fcweb /usr/local/share/freeciv

echo "==== Building freeciv-web ===="
sed -e "s/user>root/user>${mysql_user}/" -e "s/password>changeme/password>${mysql_pass}/" ${basedir}/freeciv-web/src/main/webapp/WEB-INF/resin-web.xml.dist > ${basedir}/freeciv-web/src/main/webapp/WEB-INF/resin-web.xml
cd ${basedir}/freeciv-img-extract/ && ./setup_links.sh && ./sync.sh
cd ${basedir}/scripts && ./sync-js-hand.sh
cd ${basedir}/freeciv-web && ./build.sh

echo "=============================="

rm /etc/nginx/sites-enabled/default
cp ${basedir}/publite2/nginx.conf /etc/nginx/
cp ${basedir}/publite2/nginx/freeciv-web /etc/nginx/sites-enabled/

if [ -d "/vagrant/" ]; then
echo "Starting Freeciv-web..."
service nginx start
cd ${basedir}/scripts/ && sudo -u vagrant ./start-freeciv-web.sh
echo "Freeciv-web started! Now try http://localhost/ on your host operating system."
else
echo "Freeciv-web installed. Please start it manually."
fi

0 comments on commit 2bd1036

Please sign in to comment.