Our app runs inside of the Shopify Admin, so local development requires connectivity to the Shopify.
Create a free Shopify Partner account at https://www.shopify.com/partners Set up a development app under 'Apps'. Under the App Info tab, make sure to set:
App Name = https://YOUR_DEV_APP.ngrok.io/
Whitelisted redirection URL = https://YOUR_DEV_APP.ngrok.io/auth/shopify/callback
Remember your domain YOUR_DEV_SHOP.myshopify.com
for later.
Make sure you have rvm
installed and the latest ruby as denoted in Gemfile
.
Also make sure you have a recent version of Postgres installed on your system. For Mac the easiest way is to use Postgres.app
gem install bundler
bundle install
If you have problems with rubyracer / libv8 on Os X, try gem install libv8 -v '3.16.14.3' -- --with-system-v8
(make sure it's the right version) and / or bundle update libv8
More info
Install NPM packages
yarn install
Set up the Database
bundle exec rake db:drop db:create db:migrate db:seed RAILS_ENV=development
Run the external proxy
This tunnels your localhost port 3000 to YOUR_DEV_APP.ngrok.io
ngrok http -subdomain=YOUR_DEV_APP 3000
Set up your local configs so the server doesn't give any errors.
Copy local_env.yml.example
to local_env.yml
Fill in any special credentials you have (AWS_
keys, APP_URL
, etc)
Run the server
bin/server
Open YOUR_DEV_APP.ngrok.io
in browser. You should get a screen that asks for your shopify url (YOUR_DEV_SHOP.myshopify.com
).
Enter that and click Ok, then it should ask you to install the app.
Once you've installed your shop you can optionally run this command to generate some fake data to help with development (the refresh):
rake db:sample_data
If you want to run the shop without embedding into the Touchcard admin you can set the FULLSCREEN_DEBUG
environment variable.
This is experimental, so I'd only recommend it if you're doing a lot of client reloading for javascript work, but not for testing, etc.
When you do that you should be able to load the application via http://localhost:3000/
, and in turn loading should be much snappier.
FULLSCREEN_DEBUG=true bin/server
- Look up next tag version (v#.#.# format)
- Update Changelog with changes & latest tag #.
- Create branch, commit, push to Gitlab, merge into Master.
- Ensure any ENV VAR updates are made.
- Pull master & deploy to staging.
git push heroku-staging v1.X.X^{}:master
- Ensure migrations are run.
- Manually smoke test staging. Repeat #2-7 until tests pass.
- Tag master with tag version v#.#.# (make sure commit matches staging)
- Ensure any ENV Var updates are made.
- Deploy tag to production.
- Make sure migrations are run.
- Smoke test production.
- Push tag to Gitlab.
-
Push from local
development
branch to staging'smaster
branch.git push heroku-staging development:master
-
Run a
db:migrate
if requiredheroku run rake db:migrate --app touchcard-staging
SAFE transfer of production database to staging
Or the Cowboy approach:
heroku pg:copy touchcard::DATABASE_URL DATABASE_URL -a touchcard-staging
We use S3 in two unrelated ways:
- We use it to host the postcards that are uploaded by users. This is on the following servers. These are accessed via the rails application.
touchcard-data (production)
touchcard-data-staging
touchcard-data-dev
See app.json
for latest buildpacks.