Some time ago I had a pleasure (no irony intended!) to start working in a company with no established developing process at all. There was no issue tracking, no communication tools, no code hosting…nothing (nothing but a Russian Bitrix system, but it doesn’t count, since it’s awful and nobody was using it). Now I want to share with you one of myriads of possible approaches. As it happens we pay only 5$ per month to make it work.
How to start?
First of all you’ll need a webserver. We decided to pick up the cheapest DigitalOcean droplet which is available for exactly 5$ per month. You can pick Linode or any other server, where you’ll be granted full root access. DigitalOcean comes with a fancy possibility to create a Redmine-Droplet in just 55 seconds, this is just what we did.
Where to host code?
Trust me, even if you have just one developer you better start using version control. Github is the most common service just to do so, however if you can’t afford sharing your code with the community you got to pay for private repositories. A wide known alternative would be Gitlab, which not only allows you to host the service on your own machine, but also doesn’t charge you for creating private repositories if you continue using on-demand version. I didn’t manage it to install Gitlab on our 5$ droplet (maybe I’m just not gifted… maybe it has something to do with recommended RAM size of 2 Gbyte and two unicorn worker units to be able to handle http requests – 5$ droplet got only 512 MB RAM), so we’re using private on-demand repos. However if you manage to install gitlab on your machine the following routine will be much easier, since pulling from Gitlab won’t requre any hooks as it will be on the same machine as Redmine itself.
How to connect them?
You’ll probably don’t want maintaining two systems at a time. This is where so called hooks come in play. You can try and install https://github.com/phlegx/redmine_gitlab_hook but for me, although I set up (at least I suppose so) everything correctly, it didn’t work. What I did instead was following:
- create an ssh-key on your server, where redmine is hosted (since chances are you won’t be able to copy the key to your clipboard you’ll need to send the file to your local machine first via scp
pbcopy < .ssh/id_rsa.pubscp email@example.com:foobar.txt /some/local/directory (I never know how to connect to my local PC, so instead I connect to remote machine and download the file) For example - scp firstname.lastname@example.org:/.ssh/id_rsa.pub /directory_created_for_the_key
- now comes a tricky thought – since Redmine hooks only its local repos but your local environment is another one, we need a workaround. As depictured below you need to set up your remote origin as gitlab
git remote add origin email@example.com:your_project/your_repo.git then you push using git push -u origin master
- To keep your Redmine repo up-to-date, you’ll need, first of all, to create one (on the Redmine server) – simply git init /home/redmine_projects/project1
- Create a cronjob – nano /etc/cron.d/sync_repos
- Repeat the line for each repository (app should be the owner of the repository. In our case it is “root”)
*/5 * * * * app cd /path/to/project.git && git fetch origin && git reset --soft refs/remotes/origin/master > /dev/null
- Wooosh! You’re done! Now every push will be visible just 5 minutes thereafter in your Redmine repo-tab.