28 August 2016

Setting up a perforce server on a droplet instance.

A colleague of mine was looking for a solution to host a perforce server somewhere reliably, that could be used for small personal projects. There are not many hosted perforce solutions, Assembla is the only one I know and is expensive if you only want to use it for personal small projects, it is a complete project management tool so it's more than I need.
My colleague found this project by DigitalOcean called 'droplets' where you can have a small vps for a reasonable low price. 20GB is not big, but is enough to start personal projects on. Wanting a personal perforce server myself, I immediately started with a new droplet!

So first I created a so called 'droplet' with 20GB disk space and CentOS7. It is amazing how fast this was set up, within 5 minutes I was up and running, with putty connected to my new server, cool!

To access the server I've also created a free .tk domain and pointed it to the IP address of the server.

So far the easy part. And as it turned out the rest was easy too. A perforce installation used to be a pain in the ass because the perforce documentation is hard to find for the correct version, there is no clear path on their website to the correct documentation on any server version. It used to be copying binaries to your server, chmod +x them and start configuring. But then I happened to find this page and I literally did what it said:

  • rpm --import https://package.perforce.com/perforce.pubkey
  • vi /etc/yum.repos.d/perforce.repo
    and copy pasted the repo config from the website:
    [perforce]
    name=Perforce
    baseurl=http://package.perforce.com/yum/rhel/7/x86_64
    enabled=1
    gpgcheck=1
  • yum install helix-p4d

    Done! So we list all services to see if there was a p4d instance running:

  • chkconfig --list

    No p4d to be seen, but a "perforce-p4dctl", what is that? The best info I could find is this page. Basically it says: "documentation is in the man page" and that's it. That's so weird, why wouldn't they put the info also in their knowledge base? It would be so much easier! Ah well, back to the command line:

  • man p4dctl

    Basically it's a service to manage multiple perforce instances with easy config files. Cool, way better than it used to be! So I created a .conf file according to the template in the /etc/perforce/p4dctl.conf.d folder. I created a /home/perforce folder for the P4ROOT and switched the ownership to the perforce user

  • mkdir /home/perforce
  • chown perforce:perforce /home/perforce

    And then running a list gave me this output:

    [root@alex-droplet-1 home]# p4dctl list
    Type Owner Name Config
    p4d perforce p4-ava port=1666 root=/home/perforce

    Allright! Only one thing left to do:

  • p4dctl start p4-ava

    Aaand done! Wow, this was easy!