mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 14:28:22 +00:00
Merge pull request #93 from kmpm/ubuntu
moved vagrant and changed to ubuntu
This commit is contained in:
commit
55c831733f
3
.gitignore
vendored
3
.gitignore
vendored
@ -34,9 +34,6 @@ Makefile.in
|
||||
#
|
||||
*.lo
|
||||
|
||||
#vagrant part
|
||||
vagrant
|
||||
.vagrant
|
||||
|
||||
# Compilation and Qt preprocessor part
|
||||
*.qm
|
||||
|
20
Vagrantfile
vendored
20
Vagrantfile
vendored
@ -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
|
3
contrib/buildenv/.gitignore
vendored
Normal file
3
contrib/buildenv/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
#vagrant part
|
||||
vagrant
|
||||
.vagrant
|
39
contrib/buildenv/Vagrantfile
vendored
Normal file
39
contrib/buildenv/Vagrantfile
vendored
Normal file
@ -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
|
@ -4,7 +4,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
export TWISTER_CORE_PATH='/home/vagrant/twister-core'
|
||||
export TWISTER_HOME='/home/vagrant/.twister'
|
||||
|
||||
alias twisterd='$TWISTER_CORE_PATH/src/twisterd'
|
||||
alias twisterd='$TWISTER_CORE_PATH/twisterd'
|
||||
|
||||
|
||||
|
2
scripts/bin/twister → contrib/buildenv/scripts/bin/twister
Normal file → Executable file
2
scripts/bin/twister → contrib/buildenv/scripts/bin/twister
Normal file → Executable file
@ -4,7 +4,7 @@ RPCUSER='user'
|
||||
RPCPASSWORD='pwd'
|
||||
RPCALLOWIP='127.0.0.1'
|
||||
|
||||
BIN=$TWISTER_CORE_PATH/src/twisterd
|
||||
BIN=$TWISTER_CORE_PATH/twisterd
|
||||
|
||||
CONFFILE="$TWISTER_HOME/twister.conf"
|
||||
|
131
contrib/buildenv/scripts/vagrant_bootstrap.sh
Normal file
131
contrib/buildenv/scripts/vagrant_bootstrap.sh
Normal file
@ -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,8 +1,9 @@
|
||||
# Vagrant + Debian building instructions
|
||||
# Vagrant + Ubuntu building instructions
|
||||
|
||||
This will run a virtual machine with all tools required to build and run twister
|
||||
using Vagrant.
|
||||
This will probably work wherever vagrant can be installed.
|
||||
This will probably work wherever vagrant can be installed so Windows, Mac, Linux
|
||||
at least
|
||||
|
||||
## Dependencies
|
||||
* http://www.vagrantup.com/
|
||||
@ -11,19 +12,19 @@ This will probably work wherever vagrant can be installed.
|
||||
|
||||
## Install
|
||||
1. git clone https://github.com/miguelfreitas/twister-core.git
|
||||
1. cd twister-core
|
||||
1. vagrant up
|
||||
2. cd twister-core/contrib/buildenv
|
||||
3. vagrant up
|
||||
|
||||
|
||||
|
||||
## Tweeking
|
||||
If you have lots of ram in your machine, feel free to use it
|
||||
edit the twister-core/Vagrantfile and change the line
|
||||
```
|
||||
v.customize ["modifyvm", :id, "--memory", 1024]
|
||||
```
|
||||
and write 2048, 4096 or whatever you feel resonable
|
||||
before running vagrant up.
|
||||
If you have lots of ram and CPU in your machine, feel free to use it.
|
||||
Before running vagrant up please set
|
||||
VAGRANT_RAM and/or VAGRANT_CPU environment variables to whatever is fitting.
|
||||
Default is 1 CPU and 1024 MB RAM.
|
||||
|
||||
This will make compile time and life in general much
|
||||
better in the virtual machine.
|
||||
Example with 2 CPU and 4096 MB RAM.
|
||||
```bash
|
||||
export VAGRANT_CPU=2
|
||||
export VAGRANT_RAM=4096
|
||||
```
|
@ -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
Block a user