How to Create a Full Generating Timekoin Node in a $5 VPS

Having issues with your Timekoin Server? Someone might be able to answer your questions here.
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

How to Create a Full Generating Timekoin Node in a $5 VPS

Post by warmach »

To run a timekoin server, you need a reliable system that runs 24/7 and is ideally low cost and does not take a lot to administer. I have tried all kinds of things and I have found that a cloud hosted virtual private server (VPS) with a linux OS seems to be the best option. It took me a lot of trial and error and I created this walkthrough to make it easier for new timekoin server operators.

I have tried to make it as complete, but simple as possible. I am a Windows software developer and have only used linux in the past year. So while I am confident that everything here is right, feel free to double check it and let me know. Code blocks may contain several lines but please run just one at a time.

Sign up and get a server.

There are tons of cloud server hosting companies out there with a variety of services offered. Most any one of them will do. Personally, I like Digital Ocean as it is cheap ($5/month) and simple. I will be using this service for this walkthrough. If you would like a server from Digital Ocean, please use my referral link, https://m.do.co/c/95873a7be5e8 The account credit I get from the referral program will help me maintain my timekoin servers and beef them up to be super peers, all which strengthen the network.

Create your new server by selecting a name, plan, location (US or EU), and linux OS. I will be using Ubuntu 13.10 x32 on the base $5 plan (512 RAM, 20GB SSD) for this walkthrough.

Setup server

1. SSH into server. Server address and root user and password will be emailed to you. If you are on windows, I suggest using putty to connect to the server, http://www.putty.org/

2. Change root password

Code: Select all

passwd
3. Create a new user. Here is a good guide to follow to do this. https://www.digitalocean.com/community/ ... untu-12-04 I would exit out of your connection and reconnect using the new user.

4. Update the server software with the latest updates and patches

Code: Select all

sudo apt-get update
sudo apt-get upgrade
5. Install apache, mysql, and php. Digital Ocean has a pretty good walkthrough, https://www.digitalocean.com/community/ ... -on-ubuntu Follow this guide to setup the server software.

In step 2, one of the MySQL modules listed is no longer available for version 13.x Use this instead...

Code: Select all

sudo apt-get install mysql-server php5-mysql
In step 3, I would also install the php-cli module.

Setup Timekoin

1. Get timekoin software, and unzip it. (URL and file name will change based on future releases)

Code: Select all

wget "http://timekoin.org/images/downloads/timekoinserver_v3.11.zip"
sudo apt-get install unzip
sudo unzip timekoinserver_v3.11.zip -d ~/timekoinserver_v3.11
2. Create database user and timekoin database

login w/ root MYSQL user

Code: Select all

mysql -u root -p
create new database user, change the password I have listed.

Code: Select all

CREATE USER 'tkuser'@'localhost' IDENTIFIED BY 'password';
create database

Code: Select all

CREATE DATABASE timekoin;
give the new user access to the database

Code: Select all

GRANT ALL PRIVILEGES ON  timekoin.* TO 'tkuser'@'localhost';
refresh the database privileges

Code: Select all

FLUSH PRIVILEGES;
run database setup script

Code: Select all

USE timekoin;
source ~/timekoinserver_v3.11/new_install_sql/timekoin.sql
exit

3. Make a directory in apache

Code: Select all

sudo mkdir /var/www/timekoin
4. Copy files to www/timekoin directory

Code: Select all

sudo cp -R ~/timekoinserver_v3.11/v3.11/* /var/www/timekoin/
5. Update configuration file, we used default timekoin naming and the only thing you need to change is the password to what you picked before.

Code: Select all

sudo nano /var/www/timekoin/configuration.php
6. Browse to your server IP and the timekoin directory. i.e. http://1.2.3.4/timekoin

7. Login with the default user/pass, timekoin/12345

8. Update username/pass in Options menu

9. Generate keys in the Options menu. If you already have keys, go to the Backup menu to restore them.

10. Set your domain and port in System menu. If you do not have domain, leave it blank and IP will be used automatically. I would also allow "Ambient Peer Restarts" so that the network may restart your server if it stops for some reason. NOTE: Because of default Ubuntu behavior, you must disable CLI mode and populate the "Local Server Port" field. Other linux flavors may not have this requirement.

11. Enable generation on the Generation tab.

12. Start Timekoin main and watchdog process on System tab.

13. Modify file permissions so that you can update the software from inside Timekoin

Code: Select all

sudo chown -R www-data:www-data /var/www/timekoin
sudo chmod -R 770 /var/www/timekoin
14. Create reboot start script

Code: Select all

sudo nano start_timekoin.sh
Insert this into file. You may need to adjust the ports in the URLs if they are something other than default port 80

Code: Select all

#!/bin/bash
#
# A script to restart timekoin server 
#
# In case this is a server reboot, give web server time to start
sleep 15

#  restart the main and watchdog process
wget -qO- "http://localhost/timekoin/main.php?action=begin_main" &> /dev/null
wget -qO- "http://localhost/timekoin/watchdog.php?action=begin_watchdog" &> /dev/null
set permissions to allow script to be executed

Code: Select all

sudo chmod 755 start_timekoin.sh
set script to run at reboot

Code: Select all

sudo crontab -e
Insert at end of file. Replace "YOUR_USER_NAME_HERE" with the new user you created during server setup. If using root, remove "/home"

Code: Select all

@reboot /home/YOUR_USER_NAME_HERE/start_timekoin.sh
This will get you a basic timekoin node running and generating currency. There are many system tweaks to improve performance and network speed but that is out of the scope of this walk through.

I appreciate any feedback and will update this post to incorporate new items and best practices.

If you found this helpful, tips are always welcome. Easy key: warmach
Last edited by warmach on Tue Feb 16, 2016 3:24 pm, edited 3 times in total.
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by warmach »

Reserved
jambo58
Posts: 109
Joined: Mon Mar 18, 2013 4:53 am

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by jambo58 »

great walkthrough

my question.... If multiple tkusers go with digital ocean, are they serving mutlple VPS boxes behind the same public IP and using virtual IPs for each box? would this be a problem for many timekoin servers at digital ocean ?
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by warmach »

jambo58 wrote:great walkthrough

my question.... If multiple tkusers go with digital ocean, are they serving mutlple VPS boxes behind the same public IP and using virtual IPs for each box? would this be a problem for many timekoin servers at digital ocean ?
I have 3 - 4 servers all with different IPs and have not had any problems with election and generation.
jambo58
Posts: 109
Joined: Mon Mar 18, 2013 4:53 am

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by jambo58 »

Are there any implications or specific steps to required to setup ssl (self signed or certified) with the timekoin software? On apache2.

I'm a bit worried about sending clear text over the web to the vps timekoin server especially with private keys and passwords

Would be great to add that info to this tutorial if you have done that already
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by KnightMB »

jambo58 wrote:Are there any implications or specific steps to required to setup ssl (self signed or certified) with the timekoin software? On apache2.

I'm a bit worried about sending clear text over the web to the vps timekoin server especially with private keys and passwords

Would be great to add that info to this tutorial if you have done that already
Just installing the SSL module for apache will create a self-signed certificate usually good for a couple of years. It would be the best way to avoid sending cleartext over the Internet and for good reason. A real SSL certificate can be purchased, but if you are the only one that needs it and trust your own server, it works just as well as the real thing. :mrgreen:
User avatar
smooj
Posts: 38
Joined: Sun Dec 08, 2013 4:45 am

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by smooj »

Thanks for this warmach.

What sort of generation uptime have you achieved with this?

I ask as I'm running a VPS too (centos 5 / 1gb / webmin / virtualmin) and have had plenty of problems with the database corrupting and glitches causing apache to crash or the VPS to lock up.

The most stable platform I've had so far is the windows server running on my personal DSL!
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by warmach »

jambo58 wrote:Are there any implications or specific steps to required to setup ssl (self signed or certified) with the timekoin software? On apache2.

I'm a bit worried about sending clear text over the web to the vps timekoin server especially with private keys and passwords

Would be great to add that info to this tutorial if you have done that already
I had these concerns too but had not pieced that together yet.

I found this... https://www.digitalocean.com/community/ ... untu-12-04

I can add this to the tutorial of others find it is a good way to add SSL.

Another thing I would like to see is encrypting the server keys in the database. They are stored un-encrypted. How do we secure these while leaving them usable to generate?
shazabash
Posts: 1
Joined: Fri Jan 10, 2014 8:29 pm

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by shazabash »

Hi,

First time poster, long time lurker. Thanks for creating this guide, i tried awhile ago to get this up and running on digitalocean and managed to get so far as it all running except for it being in outbound mode only and have never been able to figure out how to change that.

So i follow your guide and set it up from scratch and still in outbound only mode. On the Options tab, I did set the ports to

Code: Select all

Public Server Port - 80
Local Server Port - 80
Changing the Public Server port to 80 at least allowed me to pass the firewall check.

Hopefully you have some snazzy way of doing this.

ooh and can you put up your public key as well, happy to send you some coins for creating such a great guide.
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: How to Create a Full Generating Timekoin Node in a $5 VP

Post by warmach »

smooj wrote:Thanks for this warmach.

What sort of generation uptime have you achieved with this?

I ask as I'm running a VPS too (centos 5 / 1gb / webmin / virtualmin) and have had plenty of problems with the database corrupting and glitches causing apache to crash or the VPS to lock up.

The most stable platform I've had so far is the windows server running on my personal DSL!
I've gone at least a month before. My problem is that I play, and tweak, and mess with stuff. I end up screwing something up myself with a self written script. My VPS host, Digital Ocean, has been pretty good about notifying me of upcoming maintenance. It does not seem to happen often either. When it does I just write scripts that will remotely restart timekoin or I move the key to a temporary machine while the maintenance is taking place.

Database corruption and memory leaks are always going to be issues. It is just reality. I haven't figured out that sweet spot for how often to reboot my VPS, optimize DB, etc. I think when KnightMB adds the API call to stop timekoin, it will help as we can gracefully shutdown the service and more likely avoid database issues.
Post Reply