1. Setting up the GitHub account
Server Farmer is distributed directly from Git repositories hosted by GitHub service. There are no files for download, no deb/rpm packages to install etc.
To start your adventure with Server Farmer, you need a GitHub account. You can create it for free here, and you won't ever need any GitHub paid features to work with Server Farmer. You can also share the same account for Server Farmer and your other projects (but beware that security of your systems managed by Server Farmer relies on security of your GitHub account).
The below instructions assume that you already have a GitHub account named your-github-login.
2. Forking and preparing the repositories
Server Farmer consists of over 80 Git repositories. But don't worry, you will need to fork only 2 of them:
- https://github.com/serverfarmer/serverfarmer - main (startup) repository
- https://github.com/serverfarmer/sf-keys - repository with your personal ssh/gpg keys
Just click on both these links and then look for the Fork button in the upper section of the page:
Just click on it and you're done. You just created your own copies of Server Farmer's repositories.
Now, take a look at the documentation page of sf-keys repository and replace the default keys with your own ones (note: if this is your lab machine, when security is not a concern, and you just want to test Server Farmer, you can skip this part for now, and even use the original sf-keys repository instead of forking it).
Next you need to edit the global configuration file in the main repository. Paste the below link into the browser, and remember to change your-github-login to your GitHub login:
On this page you will find detailed explanations of each configuration option. During the first configuration pay special attention to these 3 options, everything else you can change later: external_domain, internal_domain and, if you preparing a real installation, not just a test, keys_repository.
3. Actual installation
Before you start installing Server Farmer on your servers, it is essential that you have a basic understanding of Server Farmer main server roles: farm manager and backup collector.
Ok, let's start. To install Server Farmer on your servers, you just need to log in as root and follow these console commands (again remember to change your-github-login to your GitHub login):
git clone https://github.com/your-github-login/serverfarmer /opt/farm /opt/farm/setup.sh /opt/farm/setup.sh
It's not a mistake. When you run
setup.sh script for the first time, it will ask you a few basic questions, like destination server hostname. The second time it will run the actual installation (install required system packages, extensions, ssh keys etc.).
And that's all for a single server. Server Farmer is working and you should immediately start receiving mail notifications about possible issues found on your server (if there are any).
4. Creating a simple server farm
Each server, right after installing Server Farmer, is ready to be connected to the server farm (so it already has proper ssh keys installed etc.). The following example assumes that you have already installed Server Farmer on 2 servers: you type this commands on the first one, and the second one is called your-second-server.com:
/opt/farm/scripts/setup/extension.sh sf-farm-manager /opt/farm/scripts/setup/extension.sh sf-backup-collector add-managed-host your-second-server.com sf-console your-second-server.com
And that's it. The last command should let you in to the second server's console, without typing any passwords or prividing keys. You can read the details at sf-farm-manager repository documentation page.
Congratulations, now you have a functioning farm and you can start further extending it.