Add init scripts and docs for Upstart and OpenRC #4611

pull ajweiss wants to merge 1 commits into bitcoin:master from ajweiss:ajw_1407_init_scripts changing 8 files +289 −51
  1. ajweiss commented at 5:45 PM on July 31, 2014: contributor

    Expanding on @aitorpazos earlier commit of a systemd service file, here are some additional scripts and documentation updates to support Upstart and OpenRC. Tested on Gentoo/OpenRC 0.12.4 and Ubuntu trusty/Upstart 1.12.1.

  2. in doc/README.md:None in 954c4970b0 outdated
      67 | @@ -68,7 +68,7 @@ The Bitcoin repo's [root README](https://github.com/bitcoin/bitcoin/blob/master/
      68 |  - [Assets Attribution](assets-attribution.md)
      69 |  - [Files](files.md)
      70 |  - [Tor Support](tor.md)
      71 | -- [Systemd](systemd.md)
      72 | +- [Init Scripts (systemd/upstart/openrc)](init.md)
    


    laanwj commented at 7:44 AM on August 1, 2014:

    Maybe call the document "Running as system service" (I mean the title, not the filename).


    ajweiss commented at 8:23 PM on August 1, 2014:

    Sure. Also, I noticed overnight that the Gentoo ebuild for bitcoind has a nicer OpenRC init file that checks a few more things. I'll merge in the good stuff from there too...

  3. laanwj added the label Docs and Output on Aug 1, 2014
  4. jgarzik commented at 3:07 AM on August 2, 2014: contributor

    looks good at a quick glance

  5. luke-jr commented at 3:19 AM on August 2, 2014: member

    Is there some reason not to use the Gentoo OpenRC script? It seems a lot more complete...

  6. ajweiss commented at 3:38 AM on August 2, 2014: contributor

    Yeah, it's nicer but has a weird datadir path. I'll update with a slightly modified version of it tomorrow...

  7. ajweiss commented at 3:01 AM on August 3, 2014: contributor

    Yeah, I'm not a fan of the way they just override HOME to get it to stick the datadir in /var/lib/bitcoin/.bitcoin (yuck) and use start-stop-daemon's --make-pidfile and --background to daemonize outside of bitcoind. I have something that cribs the good stuff they have in there and I'm testing it. I'll add a commit with the new stuff soon

  8. ajweiss commented at 8:07 PM on August 6, 2014: contributor

    Ok, I merged in the good stuff from the Gentoo distribution and cleaned things up in general a bit. I think this is ultimately nicer than the existing Gentoo scripts. The only thing I can think of is perhaps aiming the documentation a bit more towards doing the install yourself, but it seems that would be best coupled with some work with the gitian build stuff to actually generate binary builds. What do you guys think?

    Oh, also, tested on Gentoo (~amd64 updated yesterday) and Ubuntu 14.04.

  9. laanwj commented at 9:33 AM on August 7, 2014: member

    ACK after squashing

  10. luke-jr commented at 9:39 AM on August 7, 2014: member

    Please use /etc/bitcoin/bitcoin.conf and /var/lib/bitcoin/.bitcoin datadir to retain compatibility with existing OpenRC initscript. Additionally, rpcuser should not be required (only rpcpassword).

  11. laanwj commented at 9:44 AM on August 7, 2014: member

    Nit: I think the default for the system-wide bitcoind should be to run without wallet. This makes it usable for multiple users/applications that want to have their own access to the block chain.

  12. luke-jr commented at 10:03 AM on August 7, 2014: member

    @laanwj How does running the wallet break that use case? Seems harmless to me.

  13. laanwj commented at 10:05 AM on August 7, 2014: member

    For one, running a wallet makes the security requirements a lot tighter. Without wallet you can have the bitcoin data directory (apart from bitcoin.conf, if that's in your data directory at all) world-readable.

  14. in contrib/init/bitcoind.conf:None in d6a48f39ad outdated
      21 | +
      22 | +pre-start script
      23 | +    # this will catch non-existent config files
      24 | +    if ! grep -qs rpcuser "$BITCOIND_CONFIGFILE" ||
      25 | +        ! grep -qs rpcpassword "$BITCOIND_CONFIGFILE" ; then
      26 | +            echo "ERROR: You must set rpcuser and rpcpassword in" \
    


    Michagogo commented at 11:46 AM on August 7, 2014:

    This should probably either generate a random password and install it, or be changed to clarify that a password should be very randomized and doesn't need to be remembered, as the daemon itself does.

  15. in contrib/init/bitcoind.openrc:None in d6a48f39ad outdated
      54 | +
      55 | +checkconfig()
      56 | +{
      57 | +	if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" || \
      58 | +		! grep -qs '^rpcuser=' "${BITCOIND_CONFIGFILE}" ; then
      59 | +		eerror "You must set rpcuser and rpcpassword in" \
    


    Michagogo commented at 11:47 AM on August 7, 2014:

    This should probably either generate a random password and install it, or be changed to clarify that a password should be very randomized and doesn't need to be remembered, as the daemon itself does.


    luke-jr commented at 7:09 PM on August 7, 2014:

    Well, obviously you can always look up the password again in the file, but bitcoin-cli won't look in /etc[/bitcoin]/bitcoin.conf automatically (yet?).


    Michagogo commented at 10:19 AM on September 4, 2014:

    I mean, it's saying "set the rpcuser and rpcpassword". It should be clarified that it's not an rpcuser and rpcpassword that you should be thinking of and remembering. And yeah, it's probably a good idea to fix that somehow -- maybe with a wrapper script or something?

  16. TheBlueMatt commented at 7:46 AM on August 22, 2014: member

    Can you add (maybe in another pull) the necessary files to contrib/debian to install the right things on Ubuntu/Debian?

  17. laanwj commented at 10:15 AM on September 4, 2014: member

    Anyone still strongly against merging this? Improvements can be made later.

  18. in doc/init.md:None in d6a48f39ad outdated
      31 | +    YYYY-MM-DD HH:MM:DD Error: To use the "-server" option, you must set
      32 | +    a rpcpassword in the configuration file:
      33 | +    /etc/bitcoind.conf
      34 | +    It is recommended you use the following random password:
      35 | +    rpcuser=bitcoinrpc
      36 | +    rpcpassword=HdYZ5HGtAF7mx8aTw6uCATtD2maMAK4E12Ysp4YNZQcX
    


    Michagogo commented at 10:21 AM on September 4, 2014:

    If this is a quote, it should be changed to something that's obviously not something you should actually be using, to clarify that it's an example (like YYYY-MM-DD HH:MM:DD in line 31)

  19. ajweiss commented at 5:57 PM on September 4, 2014: contributor

    I have another round of changes to commit, but I'm traveling right now. Can you hold off until the middle of next week?

  20. Add init scripts and docs for Upstart and OpenRC 234bfbf6a5
  21. ajweiss force-pushed on Sep 9, 2014
  22. ajweiss commented at 9:06 PM on September 9, 2014: contributor

    Alright, I've cleaned up the docs a bit and have added explicit warnings about how to set the rpcpassword correctly to the scripts. Also, the wallet is now disabled by default. I think these should now serve as a pretty decent starting point.

  23. luke-jr commented at 9:11 PM on September 9, 2014: member

    @ajweiss Have you tested that existing installs won't be broken with the new OpenRC/systemd stuff?

  24. BitcoinPullTester commented at 9:17 PM on September 9, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4611_234bfbf6a5fcba37e510e9cb6c1f2a629cd0290e/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  25. ajweiss commented at 9:28 PM on September 9, 2014: contributor

    If I replace the default scripts with the new ones on my Gentoo box with bitcoind-0.9.2.1 from portage, everything looks good. There might be some potential confusion that could arise from the wallet being disabled by default, but I'm not sure what to do about that. Maybe a note in the docs? AFAIK, the systemd scripts are brand new so I don't think it's a problem there.

  26. msgilligan referenced this in commit 005f913982 on Sep 15, 2014
  27. laanwj merged this on Sep 16, 2014
  28. laanwj closed this on Sep 16, 2014

  29. laanwj referenced this in commit 2d782ab2ce on Sep 16, 2014
  30. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me