Deploy Slate to Heroku
From : https://abangiya.wordpress.com/2016/12/10/slate-heroku/
Install Slate on Local Computer
- Fork lord/slate project to your github repo, then clone to your local computer.
git clone https://github.com/YOURUSERNAME/slate.git
- Change directory to slate directory that you just cloned on your local computer.
cd slate
- Install all dependencies required to run slate on your local computer.
bundle install
- Command above will add vendor folder to your slate directory. Update .gitignore to make this folder ignored everytime you push your Slate project to remote repository.
echo ‘vendor/’ >> .gitignore
- Start server on your local.
bundle exec middleman server
If those five commands above successfuly executed, you can see your Slate page live on your browser in http://localhost:4567. At default your Slate project will run on port 4567, if you want your Slate running on different port you can just change set :port value in config.rb.
sed -i ‘s/set :port, 4567/set :port, YOUR_NEW_PORT/g’ config.rb
- Add all change to git.
git add .gitignore config.rb or just git add .
- Commit that change.
git commit -m "Init project and modify .gitignore (and config.rb if you also do that)"
Deploy to Heroku
Now we move to the next step, deploy your Slate to Heroku.
- Login to your heroku account using Heroku CLI in your terminal. Type your email and password.
heroku login
- Create heroku app. Modify YOUR_APP_NAME with anything you want your app to be named.
heroku create YOUR_APP_NAME
- Create Procfile on your slate directory to determine what command will run by your app’s dynos on the Heroku platform. Read this to get more clear explanation.
echo "web: bundle exec middleman server -p $PORT" > Procfile
- Add all change to git (again).
git add Procfile or just git add .
- Commit that change.
git commit -m “Add Procfile”
- Push your change to Heroku.
git push heroku master
- Open your Slate on your browser.
heroku open
Voila, now you can see your Slate live on https://YOUR_APP_NAME.herokuapp.com!
Now you can start build your API Documentation using Slate. Every time you add a new change you can just do git add, git commit, and git push to your heroku repo and see your Slate updated.