Open sourcing my pet project, nofity.com
What to do with my abandoned pet project? delete it? don’t renew the domain? forget about it and do nothing? I have decided to open source it so anyone can learn from it.
Last summer during a long holidays trip, still not having disconnected from my programmer lifestyle I decided to open my laptop and to check into old projects so I could delete some of them and free up some space in my laptop and in my mind.
After some minutes I stumbled upon nofity.com, an old application I used to learn about the ecosystem of Ruby on Rails, Chef, Redis, Marionette.js… and most important, keep all my links private (can talk about my privacy addiction for hours, but let’s leave it for another time)
The current version of nofity.com was started in 2014:
commit e2941f122779c13ba4ec86208bd4318ea8ff7b8f
Author: Alejandro El Informatico <xxx@xxx.xxx>
Date: Sun Feb 23 15:55:12 2014 +0100
ADD rails base version
However the first real version was written in Python using Django and Angular 1.x back in 2012.
Not gonna lie, while navigating through the code I started to remember those days when I was learning more complex architectures using Ruby on Rails and saw clear mistakes on some decisions I took, some evident over engineering and of course some code that can make it up to the list of any wall of shame™.
Even though I still use the application every now, the question now was: what to do with the app? delete it? don’t renew the domain? forget about it and do nothing?… but thought I would give it a second chance and use it to learn, at the end that was the main motivation behind writing this app.
My main motivation now is to use the application to help our junior developers at XING or any other junior developer to become even better!
Before starting some checks need to be performed first.
Secure sensitive data
All applications have some secrets, that means I could not just push my code to Github and forget about it, I had to make some tweaks before.
In case you find your self with a Rails application you want to make public the following is a list of things to consider.
Database credentials
Stored in config/database.yml
this file contains your credentials to connect to your database, and those should be kept private.
Secret key base
From Rails default project:
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
config.secret_key_base = KEY
Devise keys
If you are using some kind of authentication gem like Devise then you probably have some keys you want to remove from your repo. You can find the configuration in config/initializers/devise.rb
.
External services
When using some external services like Google Maps, Sendgrid… you need to have some keys, well it’s time to remove those keys from Git.
Other data
Maybe is a good idea to also take care of:
- Email addresses
- Google Analytics code
Any other data you might think of?
How to properly store sensitive data outside of Git?
In the Rails world, easy: environment variables.
All the previous sensitive data can be easily stored in environment variables that are defined in the host where the application is running. This prevents having those secrets in our Git repository.
Using the right license
I want to license Nofity under a license that grants anybody permissions to do almost whatever they want to do. Like many other projects the MIT license seemed the right choice.
The MIT License is short and to the point. It lets people do almost anything they want with your project, including to make and distribute closed source versions.
You can use https://choosealicense.com to find a license that fits your needs.
Going public
Now that the sensitive data is properly stored it is time to define where the application will live. The original version of nofity.com had it’s own Chef recipe to provision the server and deploy the application using Capistrano. However I think that might be a lot of hassle if I want to easily allow other people to contribute and deploy.
So time to find some alternatives.
Heroku
I’ve been always a great fan of Heroku and how it makes the life of developers really easy when deploying applications. Deploying with just a git push
? Hell yeah!
I could go with the free version however I won’t be able to easily(free of charge) install SSL certificates.
VPS
Having Chef recipes again could be a good idea but why not Puppet? or Ansible? or Terraform? or whatever is hot next?
Would be nice not to have to migrate the provisioning software too often.
Enter the solution: Heroku + VPS = Dokku
As said before I love Heroku and specially how little time it takes to get your application to production. So it seemed to me that the best option would be to have a VPS and install Dokku so I could have Heroku-like deployments. Plus I can size the server with the resources I want for a fraction of the price. Yay!
Some changes have been made in order to make the application ready for Dokku. All the rest of the code remains as it was back in since 2014.
Now that the application is running on Dokku it is time to push the code to Github, so here it is:
https://github.com/ainformatico/nofity
I have squashed all the commits into one as in the historic of the repo you could still see the old secrets, so better to keep them secret. (pun intended).
Next steps
Now that the code of the application is publicly open and anybody can just create a Pull Request and contribute I would like to start promoting Nofity as a learning project for new developers and have a system in place where every merged PR gets automatically deployed.
My vision
I would love to see how this pet project created years ago to help me learn new things helps other people to learn new skills and to see a community of people giving feedback to each other. Github and the Pull Requests workflow is the best system I know where people can just throw in ideas and share knowledge and collaboratively learn.
I would love to see how we create a system were the application gets automatically deployed to a Kubernetes cluster once a PR is merged. Maybe even using Typhoon to set up the cluster.
I would love to learn from other people too! I’m pretty sure that amazing ideas will come and will teach me new things.
Finally I would like to see how this pet project is used by other security freaks like me on how to store our favourite links and notes without shady companies behind exploiting our data in order to serve us targeted content.
I will keep Nofity free to use, and do not exploit any data from anyone. I’m completely fine covering the costs of the server, the domain and others… as long as it is useful for somebody.
— Let’s do it™
Want to open source your project? Check my guide to open source your project.