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.