miguelfreitas
11 years ago
9 changed files with 190 additions and 127 deletions
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
# -*- mode: ruby -*- |
||||
# vi: set ft=ruby : |
||||
|
||||
Vagrant.configure("2") do |config| |
||||
|
||||
config.vm.box = 'debian7' |
||||
config.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box' |
||||
|
||||
config.vm.provider "virtualbox" do |v| |
||||
v.customize ["modifyvm", :id, "--memory", 1024] |
||||
end |
||||
|
||||
#config.vm.synced_folder '.', '/srv/Mailpile' |
||||
|
||||
|
||||
config.vm.network :public_network |
||||
config.vm.network :forwarded_port, guest: 28332, host: 28332, guest_ip: '127.0.0.1' |
||||
|
||||
config.vm.provision :shell, :path => 'scripts/vagrant_bootstrap.sh' |
||||
end |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
#vagrant part |
||||
vagrant |
||||
.vagrant |
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
# -*- mode: ruby -*- |
||||
# vi: set ft=ruby : |
||||
require 'time' |
||||
timezone = Time.now.zone |
||||
|
||||
|
||||
Vagrant.configure("2") do |config| |
||||
|
||||
config.vm.define "precise64" do |precise64| |
||||
precise64.vm.box = 'precise64' |
||||
precise64.vm.box_url = 'http://files.vagrantup.com/precise64.box' |
||||
end |
||||
|
||||
#config.vm.define "saucy64" do |saucy64| |
||||
# saucy64.vm.box = 'saucy64' |
||||
# saucy64.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box' |
||||
#end |
||||
|
||||
|
||||
config.vm.provider "virtualbox" do |v| |
||||
v.customize ["modifyvm", :id, "--memory", ENV.fetch('VAGRANT_RAM', 1024)] |
||||
v.customize ["modifyvm", :id, "--cpus", ENV.fetch('VAGRANT_CPU', 1)] |
||||
v.customize ["modifyvm", :id, "--rtcuseutc", "on"] |
||||
end |
||||
|
||||
|
||||
config.vm.synced_folder "../../", "/home/vagrant/twister-core" |
||||
|
||||
config.vm.network :public_network |
||||
config.vm.network :forwarded_port, guest: 28332, host: 28332, host_ip: '127.0.0.1' |
||||
|
||||
config.vm.provision :shell do |s| |
||||
bootstrap = ENV.fetch('DO_BOOTSTRAP', 1) |
||||
compile = ENV.fetch('DO_COMPILE', 1) |
||||
run = ENV.fetch('DO_RUN', 1) |
||||
s.path = 'scripts/vagrant_bootstrap.sh' |
||||
s.args = ["#{timezone}", "#{bootstrap}", "#{compile}", "#{run}"] |
||||
end |
||||
end |
@ -0,0 +1,131 @@
@@ -0,0 +1,131 @@
|
||||
#!/bin/bash |
||||
|
||||
TWISTER_CORE_PATH='/home/vagrant/twister-core' |
||||
TWISTER_HOME='/home/vagrant/.twister' |
||||
AS_VAGRANT='sudo -u vagrant' |
||||
|
||||
if [ -n "$1" ]; then |
||||
timezone=$1 |
||||
else |
||||
timezone="UTC" |
||||
fi |
||||
|
||||
bootstrap=$2 |
||||
compile=$3 |
||||
run=$4 |
||||
|
||||
function failed { |
||||
echo |
||||
echo 'Something failed !!!!!' |
||||
echo |
||||
exit 1 |
||||
} |
||||
function checkfail { |
||||
if [ ! $? -eq 0 ]; then |
||||
failed |
||||
fi |
||||
sleep 3 |
||||
} |
||||
|
||||
|
||||
echo |
||||
echo 'Running bootstrap for twister-core' |
||||
echo " |
||||
bootstrap=$bootstrap |
||||
compile=$compile |
||||
run=$run |
||||
" |
||||
echo |
||||
echo ".. setting timezone" |
||||
service ntp stop |
||||
ntpdate ntp1.sp.se |
||||
service ntp start |
||||
echo "$timezone" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata |
||||
#$AS_VAGRANT ln -s /vagrant $TWISTER_CORE_PATH |
||||
|
||||
|
||||
echo '.. fixing permissions' |
||||
cd $TWISTER_CORE_PATH |
||||
find /vagrant/scripts -type d -exec chmod 755 {} \; |
||||
find /vagrant/scripts -type f -exec chmod 644 {} \; |
||||
chmod 755 /vagrant/scripts/bin/* |
||||
|
||||
echo '.. checking apt cache' |
||||
timestamp_file="$(mktemp)" |
||||
touch -d "$(date -R -d '1 day ago')" $timestamp_file |
||||
file=/var/cache/apt |
||||
if [ $file -ot $timestamp_file ]; then |
||||
apt-get update |
||||
fi |
||||
|
||||
|
||||
echo '.. configuration & web gui' |
||||
if [ ! -d "$TWISTER_HOME" ]; then |
||||
$AS_VAGRANT mkdir $TWISTER_HOME |
||||
cd $TWISTER_HOME |
||||
$AS_VAGRANT touch twister.conf |
||||
echo -e "rpcuser=user\nrpcpassword=pwd\nrpcallowip=*" > twister.conf |
||||
chmod 600 twister.conf |
||||
fi |
||||
|
||||
if [ ! -d "$TWISTER_HOME/html" ]; then |
||||
cd "$TWISTER_HOME" |
||||
git clone https://github.com/miguelfreitas/twister-html.git html |
||||
checkfail |
||||
fi |
||||
|
||||
|
||||
|
||||
if [ $bootstrap -eq 1 ]; then |
||||
echo '.. bootstrapping' |
||||
echo '.. installing tools and libraries' |
||||
apt-get install -y git build-essential autoconf libtool libssl-dev libboost-all-dev libdb++-dev libminiupnpc-dev openssl |
||||
checkfail |
||||
|
||||
cd $TWISTER_CORE_PATH |
||||
$AS_VAGRANT ./bootstrap.sh |
||||
checkfail |
||||
fi |
||||
|
||||
if [ $compile -eq 1 ]; then |
||||
echo '.. compiling' |
||||
$AS_VAGRANT make |
||||
checkfail |
||||
fi |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if [ $run -eq 1 ]; then |
||||
echo '.. launching twisterd' |
||||
cd $TWISTER_CORE_PATH |
||||
$AS_VAGRANT -H ./twisterd -debug -daemon |
||||
fi |
||||
|
||||
|
||||
|
||||
if [ $? -eq 0 ]; then |
||||
echo |
||||
echo '==================================================================' |
||||
echo " |
||||
Done. |
||||
Open http://127.0.0.1:28332/index.html and use the user/pwd credentials |
||||
Create your account ! |
||||
|
||||
If you want to do some development or other stuff then... |
||||
$ vargrant ssh |
||||
$ source twister-core/contrib/buildenv/scripts/activate |
||||
|
||||
This will give you some nice to have commands like |
||||
* twister start|stop - to start and stop the server |
||||
* twisted - alias to ~/twisted-core/twisted |
||||
|
||||
|
||||
Good luck! |
||||
" |
||||
else |
||||
failed |
||||
|
||||
fi |
@ -1,88 +0,0 @@
@@ -1,88 +0,0 @@
|
||||
#!/bin/bash |
||||
|
||||
TWISTER_CORE_PATH='/home/vagrant/twister-core' |
||||
TWISTER_HOME='/home/vagrant/.twister' |
||||
AS_VAGRANT='sudo -u vagrant' |
||||
|
||||
function failed { |
||||
echo |
||||
echo 'Something failed !!!!!' |
||||
echo |
||||
exit 1 |
||||
} |
||||
function checkfail { |
||||
if [ ! $? -eq 0 ]; then |
||||
failed |
||||
fi |
||||
sleep 3 |
||||
} |
||||
|
||||
echo |
||||
echo 'Running bootstrap for twister-core' |
||||
echo |
||||
$AS_VAGRANT ln -s /vagrant $TWISTER_CORE_PATH |
||||
|
||||
|
||||
echo '.. fixing permissions' |
||||
cd $TWISTER_CORE_PATH |
||||
find $TWISTER_CORE_PATH/scripts -type d -exec chmod 755 {} \; |
||||
find $TWISTER_CORE_PATH/scripts -type f -exec chmod 644 {} \; |
||||
chmod 755 $TWISTER_CORE_PATH/scripts/bin/* |
||||
apt-get update |
||||
|
||||
|
||||
echo '.. installing tools and libraries' |
||||
apt-get install -y git build-essential autoconf libtool libssl-dev libboost-all-dev libdb++-dev libminiupnpc-dev openssl |
||||
checkfail |
||||
|
||||
|
||||
echo '.. bootstrapping libtorrent' |
||||
cd $TWISTER_CORE_PATH/libtorrent |
||||
$AS_VAGRANT ./bootstrap.sh |
||||
checkfail |
||||
$AS_VAGRANT ./configure --enable-logging --enable-debug --enable-dht |
||||
checkfail |
||||
|
||||
|
||||
echo '.. compiling' |
||||
cd $TWISTER_CORE_PATH/src |
||||
$AS_VAGRANT make -f makefile.unix |
||||
checkfail |
||||
|
||||
|
||||
echo '.. configuration & web gui' |
||||
$AS_VAGRANT mkdir $TWISTER_HOME |
||||
cd $TWISTER_HOME |
||||
$AS_VAGRANT touch twister.conf |
||||
echo -e "rpcuser=user\nrpcpassword=pwd\nrpcallowip=127.0.0.1" > twister.conf |
||||
chmod 600 twister.conf |
||||
git clone https://github.com/miguelfreitas/twister-html.git html |
||||
checkfail |
||||
|
||||
|
||||
|
||||
|
||||
if [ $? -eq 0 ]; then |
||||
echo |
||||
echo '==================================================================' |
||||
echo " |
||||
Done. |
||||
To start the web interface, enter the following command: |
||||
$ vagrant ssh -c '$TWISTER_CORE_PATH/src/twisterd -daemon -debug' |
||||
Open http://127.0.0.1:28332/index.html and use the user/pwd credentials |
||||
Create your account ! |
||||
|
||||
If you want to do some development or other stuff then... |
||||
$ vargrant ssh |
||||
$ source twister-core/scripts/activate |
||||
|
||||
This will give you some nice to have commands like |
||||
* twister start|stop - to start and stop the server |
||||
* twisted - alias to ~/twisted-core/src/twisted |
||||
|
||||
Good luck! |
||||
" |
||||
else |
||||
failed |
||||
|
||||
fi |
Loading…
Reference in new issue