Pages:
Author

Topic: Avalon users: bitcoind and slush's/generalfaults mining pool setup - page 6. (Read 39216 times)

full member
Activity: 137
Merit: 100
Are you using a external database like mysql?
What section of the tute did you get the error in?
I havent seen the error before you might be able to get more answers in the pools forums there is thread there for stratum pool software.

Sir. Thanks for your reply. I have fixed the issue. It was because I did not install sqlite on that fresh ubuntu.
legendary
Activity: 2702
Merit: 1468
Replace the bits you need to

Code:
# bitcoind upstart script for Ubuntu

description "Bitcoin daemon"

start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 60
setuid yourusernameforbitcoinhere
expect fork
exec /usr/local/bin/bitcoind -datadir=/home/yourusernameforbitcoinhere/.bitcoin


Code:
description "Start and stop slush on bitcoind start"

respawn
respawn limit 10 60
expect fork

start on started bitcoind
stop on stopped bitcoind
setuid poolusernamehere
pre-start script
   sleep 30
end script

chdir /home/poolocation/git/stratum-mining
exec twistd --syslog -ny /home/poollocation/git/stratum-mining/launcher.tac &



Thanks tiktok. Got it working now.  On my system, upstart did not like sleep 30 or sleep 30s, so I moved all the waits and other checks to my own daemon which calls execl phyton/twistd process.  Works ok.  I just need to add some smarter monitoring of bitcoind and twistd to my daemon.
Thinking of polling 'bitcoind getinfo'  or something like that, instead of sleep.

  
full member
Activity: 176
Merit: 100
Are you using a external database like mysql?
What section of the tute did you get the error in?
I havent seen the error before you might be able to get more answers in the pools forums there is thread there for stratum pool software.
full member
Activity: 137
Merit: 100
Thanks tiktok. This is the best tutorial related with bitcoin. I have bookmarked it.

During installation I got the following error message, please help me check it:

Code:
mypoolroot@ubuntu:~/git/stratum-mining$ twistd -ny launcher.tac -l -
2013-05-23 22:56:08,199 INFO mining # Connecting to bitcoind...
2013-05-23 22:56:08-0500 [-] Log opened.
2013-05-23 22:56:08-0500 [-] twistd 13.0.0 (/usr/bin/python 2.7.3) starting up.
2013-05-23 22:56:08-0500 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2013-05-23 22:56:22-0500 [-] Unhandled Error
        Traceback (most recent call last):
          File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 402, in startReactor
            self.config, oldstdout, oldstderr, self.profiler, reactor)
          File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 323, in runReactorWithLogging
            reactor.run()
          File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-i686.egg/twisted/internet/base.py", line 1192, in run
            self.mainLoop()
          File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-i686.egg/twisted/internet/base.py", line 1201, in mainLoop
            self.runUntilCurrent()
        --- ---
          File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-i686.egg/twisted/internet/base.py", line 824, in runUntilCurrent
            call.func(*call.args, **call.kw)
          File "/home/mypoolroot/git/stratum-mining/mining/DBInterface.py", line 80, in run_import
            d = self.bitcoinrpc.getinfo()
        exceptions.AttributeError: DBInterface instance has no attribute 'bitcoinrpc'

2013-05-23 22:57:23,541 INFO mining # Connected to bitcoind - Ready to GO!

full member
Activity: 176
Merit: 100
Played with it briefly it seemed to work not never looked at it very closely, maybe ask in the stratum pool thread in the pools sub forum.
sr. member
Activity: 294
Merit: 262
I have a problem with the mysql set up...
I've got it all done, it connected obviously, even got a entry at poolworker. but now I dont get any further? It does not update anything.GUIMiner says shares accepted, but DB is still empty except for the poolworker name.

Any experience?
full member
Activity: 176
Merit: 100
could be memory related ? seems a lot of transactions that pools wont accept are floating around at the moment and staying in memory permanently check the p2pool thread has more information.
sr. member
Activity: 490
Merit: 255
I didn't notice that setuid option.... that is so much cleaner than trying to run the command through a su -c.

Anyone else seeing instability with bitcoind?
I see it crash every couple of days.

It restarts fast enough that I haven't bothered to look any further.
full member
Activity: 176
Merit: 100
Replace the bits you need to

Code:
# bitcoind upstart script for Ubuntu

description "Bitcoin daemon"

start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 60
setuid yourusernameforbitcoinhere
expect fork
exec /usr/local/bin/bitcoind -datadir=/home/yourusernameforbitcoinhere/.bitcoin


Code:
description "Start and stop slush on bitcoind start"

respawn
respawn limit 10 60
expect fork

start on started bitcoind
stop on stopped bitcoind
setuid poolusernamehere
pre-start script
   sleep 30
end script

chdir /home/poolocation/git/stratum-mining
exec twistd --syslog -ny /home/poollocation/git/stratum-mining/launcher.tac &

full member
Activity: 176
Merit: 100
There is also logs for upstart in the /var/log directory.
I have a modified version for both but they are on a machine I cant access at the moment, I will post them when I get home.
legendary
Activity: 2702
Merit: 1468
Code:
description "Start and stop slush on bitcoind start"

respawn
expect fork

start on started bitcoind
stop on stopped bitcoind

pre-start script
   sleep 30
end script

chdir /pool/build/slushbuild/stratum-mining
exec twistd --syslog -ny launcher.tac &



Does this work for you?  I'm using 12.04 server, I've tried to start it as above, from an external shell, and a C daemon program.  Nothing works.
All my methods work after manual login and starting it from a command line, but nothing works from upstart.  I also changed start on events to
start on level 2345, but phyton/twistd don't start.  Is there way a to debug upstart?  dmesg does not show much.



sr. member
Activity: 490
Merit: 255
The easiest way to debug upstart is to use initctl to emit the events on demand... but I have found upstart to be a bit of a pain.

I have moved away from upstart and instead now have a user cron script that runs every minute and checks if bitcoind and slush are running.  A bit less elegant, but it gets the job done.

I found that in my setup, bitcoind (0.81) crashes every couple of days... so really this was to deal with that problem.

Code:
foreman@camelot:~$ crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
  * *   *  *    *     /home/foreman/bin/mining_watchdog.sh

and the watchdog:
Code:
foreman@camelot:~$ cat bin/mining_watchdog.sh 
#!/bin/bash

BITCOIND_PID=$(ps auxww |grep bitcoind |grep daemon | awk '{print $2}')
if [ -z "$BITCOIND_PID" ]; then
    logger "no bitcoind found - start it up"
    trickle -s -u 100 /usr/bin/bitcoind -daemon -datadir=/pool/data -blocknotify=/pool/data/newblock.sh

    SLUSH_PID=$(ps auxww |grep launcher.tac |grep python | awk '{print $2}')
    if [ -n "$SLUSH_PID" ]; then
logger "bitcoind died but slush running - killing slush"
kill -HUP $SLUSH_PID
sleep 3
SLUSH_PID=$(ps auxww |grep launcher.tac |grep python | awk '{print $2}')
if [ -n "$SLUSH_PID" ]; then
    logger "slush still running after kill - one last try"
    kill -9 $(ps auxww |grep launcher.tac |grep python | awk '{print $2}')
fi
    fi
fi

sleep 45
SLUSH_PID=$(ps auxww |grep launcher.tac |grep python | awk '{print $2}')
if [ -z "$SLUSH_PID" ]; then
    logger "Starting Slush"
    ( cd  /home/foreman/build/stratum-mining; twistd --syslog -ny launcher.tac & )   
fi

All the absolute pathing needs to be changed to reflect your home and bitcoind data dirs.

Note... I am using trickle on my bitcoind so it doesn't eat up all the bandwidth. 
If the wife can't watch "Dancing with the stars" on hulu, then my bitcoin hobby is put in jeopardy.

Hope that is useful for the unix literate in the thread.
full member
Activity: 176
Merit: 100
Thanks Smiley

I fiddled with simple coin and mining farm. Got simplecoin to kinda work. You need to change the pool conf file to write to MySQL and setup MySQL.

But a MAJOR warning. Simple coin currently apparently had major security flaws. So it needs work and code review and maybe even design review on how payments are processed. There are some chose changes in pull request that haven't been applied.

So currently I don't think it is safe to use. As there has been a fair few cases of pools who used it when it was first released being hacked.
full member
Activity: 172
Merit: 100
First of all can I just say a huge thanks to tiktoc for one of the best tutorials I've ever seen for building software. I've seen some good tutorials in my time but nearly all needed some sort of tweaking; this one worked first time for me...thanks so much.

Just wanted to expand the discussion, to adding a web frontend for pool management and adding users. Has anybody set up a frontend after following this setup. I've tried SimpleCoin but having issues linking it to the data that Stratum has gathered.

There seems to be loads of frontends that will link in with pushpool and poolserverj but they don't support Stratum right now afaik. I would like to continue with Stratum as that looks to be the way to go and a frontend that would bolt onto this setup from tiktoc would be great.

Any help that anybody could give would be greatly appreciated.



member
Activity: 91
Merit: 11
 
Quote
Also you are not in the git directory, when you do the easy_install stratum  be in the directory before the stratum directory.

Thanks, that did it.
full member
Activity: 176
Merit: 100
if i put up a ufw firewall on this 12.10 server, what ports would i have to open?

8332 and 8333 come to mind but what about 3333?

Depends what you are doing? and where is the server. (e.g. is it at home or live on the net somewhere)

But you will need to add the pool server 3333 also its stats port if you wish to use it 8889
Also the 8333 bitcoind port.
JSON port isn't needed unless you have software outside accessing it.

If the server is hosted somewhere you will have open up ssh port to allow access to ip from where you are accessing the server from(if you don't have a static ip at home this gets complicated).
Make sure you create ssh keys and turn off password authentication. (google open ssh keys ubuntu) for how to do it. Make sure you test it or have easy access to the machine before you disable password auth.
If its live on the net somewhere please make sure that the pool and bitcoind are running under their own nologin usernames and definitely not root.

Id recheck the payout address on a regular basis as well. Don't use a address from the local wallet on the machine, use  cold wallet with a watch only address.

The list is semi endless on securing it. If its for mining for others as well get help.


full member
Activity: 176
Merit: 100
Trying to get this setup in preparation for impending Avalon arrival.

Machine is running 64 bit version of Ubuntu 12.10.

Here is a transcript of my pain:

Quote
root@avalon:/home/jack# easy_install -U distribute
Searching for distribute
Reading http://pypi.python.org/simple/distribute/
Reading http://packages.python.org/distribute
Best match: distribute 0.6.36
Processing distribute-0.6.36-py2.7.egg
distribute 0.6.36 is already the active version in easy-install.pth
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin
Using /usr/local/lib/python2.7/dist-packages/distribute-0.6.36-py2.7.egg
Processing dependencies for distribute
Finished processing dependencies for distribute


root@avalon:/home/jack# easy_install stratum
Searching for stratum
Reading http://pypi.python.org/simple/stratum/
Reading http://blog.bitcoin.cz/stratum
Best match: stratum 0.2.12
Downloading http://pypi.python.org/packages/source/s/stratum/stratum-0.2.12.tar.gz#md5=a685da0dce43263db08ae949568b0f54
Processing stratum-0.2.12.tar.gz
Running stratum-0.2.12/setup.py -q bdist_egg --dist-dir /tmp/easy_install-VMEAZ0/stratum-0.2.12/egg-dist-tmp-RDHzmk
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24dev-r0 (/usr/lib/python2.7/dist-packages))
error: Setup script exited with 2

It looks like Stratum is demanding a version of distribute of >=0.6.28 and doesn't recognize distribute 0.6.36.

Any suggested workarounds?

thanks,

humble

Maybe follow the actual instructions? I dont install it as root. sudo carries some path environment variables across.

Which might be causing what happens. Also you are not in the git directory, when you do the easy_install stratum  be in the directory before the stratum directory.

If both of those dont work.

change directory to inside the stratum directory.

then
Code:
sudo python setup.py install

legendary
Activity: 1764
Merit: 1002
if i put up a ufw firewall on this 12.10 server, what ports would i have to open?

8332 and 8333 come to mind but what about 3333?
member
Activity: 91
Merit: 11
Trying to get this setup in preparation for impending Avalon arrival.

Machine is running 64 bit version of Ubuntu 12.10.

Here is a transcript of my pain:

Quote
root@avalon:/home/jack# easy_install -U distribute
Searching for distribute
Reading http://pypi.python.org/simple/distribute/
Reading http://packages.python.org/distribute
Best match: distribute 0.6.36
Processing distribute-0.6.36-py2.7.egg
distribute 0.6.36 is already the active version in easy-install.pth
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin
Using /usr/local/lib/python2.7/dist-packages/distribute-0.6.36-py2.7.egg
Processing dependencies for distribute
Finished processing dependencies for distribute


root@avalon:/home/jack# easy_install stratum
Searching for stratum
Reading http://pypi.python.org/simple/stratum/
Reading http://blog.bitcoin.cz/stratum
Best match: stratum 0.2.12
Downloading http://pypi.python.org/packages/source/s/stratum/stratum-0.2.12.tar.gz#md5=a685da0dce43263db08ae949568b0f54
Processing stratum-0.2.12.tar.gz
Running stratum-0.2.12/setup.py -q bdist_egg --dist-dir /tmp/easy_install-VMEAZ0/stratum-0.2.12/egg-dist-tmp-RDHzmk
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24dev-r0 (/usr/lib/python2.7/dist-packages))
error: Setup script exited with 2

It looks like Stratum is demanding a version of distribute of >=0.6.28 and doesn't recognize distribute 0.6.36.

Any suggested workarounds?

thanks,

humble
full member
Activity: 176
Merit: 100
Nope it's any password and username you want the pool software will add it automatically. Like the worker username and password you make for other pools
Pages:
Jump to: