[GUIDE] How to start Steem-in-a-box on reboot using SystemdsteemCreated with Sketch.

in #witness-category7 years ago (edited)

A question that is always asked is: How can I make steem-in-a-box start on boot?

After a short discussion with @yuriks2000, I decided to investigate hooking up SIAB with systemd, for automatic start-up on boot.

Semi-related note: For Steemfeed-JS I just use a cron, which helps to resolve the "Invalid signature" problem after running for a while.

0 */2   *  *    *    docker restart steemfeed

Requirements

  • Ubuntu 16.04, or other distro which uses systemd
  • Basic Linux knowledge

Problems

Starting up STEEM this way, will always replay on boot. This might not be what you want, as it means reboots will always be painful if they're intentional.

If you are intentionally rebooting, you may want to disable the systemd service, copy /dev/shm to disk, then reboot. This way you will not need to replay, as you can restore the shared_memory.xxx files into /dev/shm

Set up /dev/shm size to persist

We can edit /etc/fstab to persist the size, instead of constantly using ./run.sh shm_size every time we reboot.

sudo nano /etc/fstab

Make a new line at the bottom, and put:

tmpfs   /dev/shm         tmpfs   nodev,nosuid,size=14G          0  0

This means, /dev/shm will become 14 gigabytes on boot. If you don't have this much RAM, you should make it smaller. At the current point of time, a low memory mode witness uses at least 7GB, so you'll need at least a 10G /dev/shm for breathing room.

Add systemd script

You'll need to create a systemd script.

To do this, we'll create a service called steem.service.

nano /etc/systemd/system/steem.service

Paste in the following (adjust the username and file locations as required. make sure .env exists, or you'll have issues)

[Unit]
Description=SteemInABox
After=network.target

[Service]
Type=oneshot
User=ubuntu
ExecStart=/home/ubuntu/steem-docker/run.sh replay
ExecStop=/home/ubuntu/steem-docker/run.sh stop
EnvironmentFile=/home/ubuntu/steem-docker/.env
WorkingDirectory=/home/ubuntu/steem-docker

[Install]
WantedBy=default.target

Now save and exit.

Finally, we can enable the service.

systemctl enable steem

This will set up the service to start on boot.

You can reboot to see if it worked.


You should now have your witness/seed/etc. starting on boot, with replay, and your /dev/shm automatically sized on boot :)


Do you like what I'm doing for STEEM/Steemit?

Vote for me to be a witness - every vote counts.

Don't forget to follow me for more like this.


Have you ever thought about being a witness yourself? Contact me on STEEMIT.CHAT, or just ask in the witness channel. I'm happy to guide you! Join in shaping the STEEM economy.

Are you looking for a new server provider? My company @privex offers highly-reliable and affordable dedicated and virtual servers for STEEM, LTC, and BTC! Contact me on STEEMIT.CHAT for more information.

This post is 100% powered up

Sort:  

@someguy123 is very helpful! I found his guide on how to setup witness the most useful out of four I tried.

Well I hope this can help some new and aspiring witnesses run their servers more smoothly and easily.
Thanks for all your great work on Steemit @someguy123

good one.keep it up

Thank you for creating great thing. Can you tell me the hardware requirements to be a witness? For example, I wanna be a witness of peerplays.

PeerPlays only uses about 1GB of RAM, so I normally recommend a 4GB RAM VPS for some breathing room. (that's just $30/mo from Privex).

For STEEM, it uses around 9GB of RAM total (assuming you hold shared-memory in RAM), so I usually recommend 16GB

This is very helpful ..thanks for sharing

Mr @someguy123 i liked you in somehow i don t know why .....so i will fill comfortable to vote for you to be a witness ....just don t forget those who helped u to get the the top of the list because they have chosen you and trusted you to represent them in the system ...good luck ;)

@someguy123

FYI - Just posted this article.

Analysis of Steem's Economy - A Social Scientist's First Impressions - Part 3/4 in the series.

https://steemit.com/steemit/@cyberspace/analysis-of-steem-s-economy-a-social-scientist-s-first-impressions-part-3-4

Coin Marketplace

STEEM 0.22
TRX 0.26
JST 0.040
BTC 98487.39
ETH 3469.86
USDT 1.00
SBD 3.23