Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevinnguy/dokku-aws-tutorial
A tutorial on setting up Dokku on your local machine via Vagrant and AWS EC2
https://github.com/kevinnguy/dokku-aws-tutorial
Last synced: 8 days ago
JSON representation
A tutorial on setting up Dokku on your local machine via Vagrant and AWS EC2
- Host: GitHub
- URL: https://github.com/kevinnguy/dokku-aws-tutorial
- Owner: kevinnguy
- Created: 2015-12-06T05:49:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-08T22:59:14.000Z (over 7 years ago)
- Last Synced: 2024-08-01T15:29:39.087Z (3 months ago)
- Size: 104 KB
- Stars: 29
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dokku - AWS Tutorial
A tutorial on setting up Dokku on your local machine via Vagrant and on AWS EC2. Thanks to [this article](https://medium.com/@alfeto/dokku-on-vagrant-and-aws-with-postgres-8a591bb48f51) for teaching me how to do this.## Installation
1. Clone the [Dokku repo](https://github.com/dokku/dokku) to your local machine
`git clone [email protected]:dokku/dokku.git`2. Install [Vagrant](https://docs.vagrantup.com) (I suggest installing via [brew cask](https://caskroom.github.io/))
`brew cask install vagrant`3. Install [VirtualBox](https://www.virtualbox.org) in order to set up Vagrant
`brew cask install virtualbox`4. (Optional) I would also install [Vagrant Manager](http://vagrantmanager.com) to manage your Vagrant machines
`brew cask install vagrant-manager`## Set up project for Dokku
For this tutorial, I'm going to use an Express app as an example. You can clone the example app repo [here.](https://github.com/kevinnguy/express-example)The folder name should be `express-example` and we will use this name as our project name for the tutorial.
## Set up Dokku on your local Vagrant machine
1. Create the Vagrant virtual machine by changing directory to your local Dokku repo
`cd /path/to/local/dokku`2. Create a Vagrant virtual machine with Dokku!
`vagrant up`3. You want to set the local IP (default is 10.0.0.2) of your Vagrant machine in your `/etc/hosts` file and pick a hostname. For this tutorial, we will use the hostname `dokku.me`
`10.0.0.2 dokku.me`## Finish setting up Dokku on your local Vagrant machine
1. Access [dokku.me](http://dokku.me) on your browser.
![browser](1.png "browser")2. Paste your ssh public key, found at `~/.ssh/id_rsa.pub`. This ssh public key should be the same key you used to clone the example app.
3. Set `Hostname` to `dokku.me`
4. Check `Use virtualhost naming for apps` This will allow you to access `.dokku.me`
5. Edit your `/etc/hosts` file and add another host
`10.0.0.2 express-example.dokku.me`## Set up project for Dokku (Part 2)
1. Add the new Dokku instance as a git remote to our example app so we can start pushing changes locally to Dokku on our local Vagrant virtual machine.
`git remote add local [email protected]:express-example`2. Make a change to your view in the Express example app and push your changes
`git push local master`# We're half way there!
Now we're going to set up Dokku on our AWS EC2 server so we can push our changes remotely to our server.## Set up AWS
1. Launch a new instance for EC2.2. From the Quick Start page, select the Ubuntu Server machine image.
![aws](2.png "aws")3. Select any instance type. For this tutorial, you probably want to select the `t2.micro` type, since it is eligible for free tier users.
4. Configure your security group by adding types:
- `SSH` on port `22`
- `HTTP` on port `80`
- (Adding `TCP` on port range `20000-65535` might be necessary too)
![security](3.png "security")5. Launch your new instance and download the `.pem` file for ssh access.
6. Once you have launched your instance, get it's public IP and add it to your `/etc/hosts` file. We will use the hostname `dokku.aws.me`
` dokku.aws.me`## Set up Dokku on your EC2 instance
1. SSH into your EC2 instance
`ssh -i /path/to/file.pem [email protected]`2. Install Dokku via `wget`
`wget https://raw.githubusercontent.com/progrium/dokku/v0.4.5/bootstrap.sh`
`sudo DOKKU_TAG=v0.4.5 bash`3. Once Dokku is installed, access [dokku.aws.me](http://dokku.aws.me) on your browser.
![browser](1.png "browser")4. Paste the same ssh public key as before, from `~/.ssh/id_rsa.pub`
5. Set `Hostname` to `dokku.aws.me`
6. Check `Use virtualhost naming for apps`
7. Add another hostname to your `/etc/hosts` file.
` express-example.dokku.aws.me`## Set up project for Dokku (Part 3)
1. Add the EC2 instance as a git remote to our example app so we can start pushing changes remotely to Dokku on our EC2 Ubuntu server.
`git remote add aws [email protected]:express-example`2. Make a change to your view in the Express example app and push your changes
`git push aws master`# We're done!
You can now see your changes on [http://express-example.dokku.aws.me](http://express-example.dokku.aws.me)! By having Dokku set up on our local machine via Vagrant and on EC2, we now have two environments to push and deploy our app.I'm still learning how to use Dokku so if there are any errors, please let me know!