Jumpstart Rails Tutorial 01 - Bringing an Existing Codebase In
Updated: 5/5/2020
It is the second day of the New Year – welcome to 2020 – and I have still failed to launch my side project that I started midway through 2019. Sigh. I find myself fundamentally regretting this but, well, life:
- New Job
- Wife in Hospital
- Son and Schooling Issues
- Etc
So my New Year's Resolution(s) is:
- Launch by end of Q1, 2020
- Not have deployment eat my brain
- Launch with Something that I'm Visually Proud Of
- Launch with SAAS billing features from day 1 and Get paying Customers
That last item, SAAS billing features, is a sticky point. I've actually implemented this myself before – I wrote all the back end code for the AppData SAAS engine which successfully processed over 3.1 million dollars in revenue over a 5 year period (BrainTree api). And I really, really, really don't want to rewrite that. Nor do I want to use a third party service and lose another percentage chunk over baseline Stripe fees.
And all of this means that I need to use the Jumpstart Rails application framework. I already have a license for it anyway and the issue is that I need to port an existing, almost complete Rails app into it. All of the blog posts starting with Jumpstart Rails Tutorial nn will cover this process. While there is good documentation for Jumpstart Rails, it is reference material rather than how to material.
Note: If anything I write during this series comes off as critical of Chris Oliver, the man behind Jumpstart Rails, it isn't. I am an unabashed fan of the damn fine work that Chris Oliver does.
Step 1 - Getting Started with Jumpstart Rails - Clone the Repo
The first step is to purchase an actual license for Jumpstart Rails. This will get you added onto the Jumpstart Rails git repo:
https://gitlab.com/gorails/jumpstart-pro
What you need to do is begin by cloning this repo down to your local system:
git clone git@gitlab.com:gorails/jumpstart-pro.git web_change_me_now2
You notice that I changed the name of this to:
web_change_me_now2
I changed it since my previous repo name was web_change_me_now and this is going to be the second version of it.
Step 2 - Run Yarn Install
Change into the directory that you just cloned the repo into and:
cd web_change_me_now2
yarn install --check-files
Step 3 - Update database.yml
The file config/database.yml needs to be updated to reflect the name of your new application's database. This means changing:
- jumpstart_development
- jumpstart_test
- jumpstart_production
Step 4 - Add Your Local Version to Github
I then went to github (I'm a staunch github user instead of gitlib) and created a new repo named:
web_change_me_now2
I then needed to add this as an origin:
git remote add web_change_me_now2 git@github.com:fuzzygroup/web_change_me_now2.git
My next step is to push. Now I need to be careful here since I can't push back to the gitlab remote since I don't have permissions for that (and any changes I make are to my application not the template). Here's the push syntax:
/* make some silly ass change; I messed about with README.md */
git add .
git commit -m "readme change"
git push web_change_me_now2 master
I don't use remotes all that much – and I suspect outside of Heroku, you don't either – so here's the syntax:
git push ORIGIN_NAME BRANCH_NAME
So if I want to push my changes, I need to do:
git push web_change_me_now2 master
Note: You may want to reverse the order of Steps 5 and 4 (i.e. create a local develop branch first and then push to that) . After that you can change into master, merge develop and then push to master. Overall that seems to work better but I'm still confirming this which is why I haven't fully rewritten this blog post.
Step 5 - Getting a develop Branch in Place
I'm a firm believer in a simple, branch based approach to git. I've talked about this before and, specifically:
- Always work in a branch tied to an issue number.
- Issue branches are merged into develop.
- Develop is merged into master.
- Master is then deployed.
This is simple, straight forward and clean. I've now worked on teams up to 10 people in size and in Rails code bases of several hundred thousand lines using this with nary a hitch so it is an excellent model for small startups.
This needs to be done in your terminal and then in Github itself:
- In your terminal, create a branch named develop with: git branch develop
- In your terminal, change into that branch with: git co develop
- Again update the README.md so you have something to push.
- Add with: git add .
- Commit with: git commit -m "readme change"
- Push with: git push web_change_me_now2 develop
- Go into github and pull up your repository.
- Go into the settings link. Mine is here: https://github.com/gochangeme/web_change_me_now2/settings
- Go into the Branches link. Mine is here: https://github.com/gochangeme/web_change_me_now3/settings/branches
- You will see the default branch is set to master. Use the drop down to pick develop and then click the update button.
- Click the I understand … button.
- Submit the pull request (you may need to change things a bit with the drop down due to changing the default).
- Click the merge button.
At this point you are now set for development using the model above. The next blog post along these lines will focus on taking an initial model and controller and start to develop a porting process.
Posted In: #rails #jumpstart