Skip to content

Commit

Permalink
spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
lnfel committed Dec 10, 2019
1 parent 428e112 commit 2be82ec
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,47 @@ _app versions are indicated at the time of this writing (Dec. 9, 2019)_
##### 1. **Obtain a domain name**
For testing I used **Freenom** which is you guessed, free domain hosting. Alan uses Namecheap and is proud about it.

2. **Signup for Digitalocean**
##### 2. **Signup for Digitalocean**
One of the best and cheapest VPS hosting you can find out there.

3. **Create a Droplet on Digitalocean**
##### 3. **Create a Droplet on Digitalocean**
You can create a droplet (virtual private server) with Dokku pre-installed! When creating a droplet, select the Marketplace and look for Dokku, [add your SSH keys](https://timleland.com/copy-ssh-key-to-clipboard/) and for testing you can select the lowest and cheapest plan.

4. **Go to your server's IP and follow the web installer**
##### 4. **Go to your server's IP and follow the web installer**
Navigate to your droplet's IP address which will be listed in digitalocean. You will need to paste in your public ssh key, then make sure to check "Virtual host naming" for your apps. It means that if you create an app called _myapp_, it will be accessible at _myapp.mydomain.com_

5. **Put your domain on Hostname field**
##### 5. **Put your domain on Hostname field**
This will be important as dokku will generate url based on what you put on Hostname field such as _myapp.**mydomain.com**_ where **mydomain.com** is the hostname. It is possible to change hostnames after installation but I would just recommend to rebuild the app completely if you are changing hostnames.

## Creating a Dokku app

5. **SSH onto your server**
##### 5. **SSH onto your server**

```console
ssh [email protected]
```

6. **Update everything** (Digital Ocean's droplets will not be completely up to date, and Dokku can easily be a few versions behind)
##### 6. **Update everything** (Digital Ocean's droplets will not be completely up to date, and Dokku can easily be a few versions behind)

```console
apt update && apt upgrade
```

7. **Create the app**
##### 7. **Create the app**

```console
dokku apps:create yourappname
```

8. **Install Postgres, create and link database**
##### 8. **Install Postgres, create and link database**

```console
dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create yourdbname
dokku postgres:link yourdbname yourappname
```

9. **Create a swap file** to help out on the ram front. You will only see output after the 3rd line.
##### 9. **Create a swap file** to help out on the ram front. You will only see output after the 3rd line.

```console
fallocate -l 2G /swapfile
Expand All @@ -62,13 +62,13 @@ mkswap /swapfile
swapon /swapfile
```

10. **Open fstab with Vim**
##### 10. **Open fstab with Vim**

```console
vi /etc/fstab
```

11. **Add this line at the bottom**
##### 11. **Add this line at the bottom**

```console
/swapfile none swap sw 0 0
Expand All @@ -78,7 +78,7 @@ vi /etc/fstab
* Press "esc" after finish adding the line to exit edit mode
* Press "shift+:" then type "wq" to write file and quit editor

12. **Configure Digitalocean DNS**
##### 12. **Configure Digitalocean DNS**
Click Add domain on digitalocean then add the domain you have got freely on freenom or bought on namecheap.
Create 'A' record for your domain:

Expand All @@ -88,13 +88,13 @@ A | yourdomain.com | (select your droplet)

## Rails app

1. **Creating the app**
##### 1. **Creating the app**

```ruby
rails new yourrailsapp --database=postgresql
```

2. **Navigate to your app directory and generate a controller**
##### 2. **Navigate to your app directory and generate a controller**

```ruby
cd awesomeapp
Expand All @@ -109,7 +109,7 @@ rails generate controller Static index
root 'static#index'
```

3. **Automatic Migrations**
##### 3. **Automatic Migrations**
This one just runs `rails db:migrate` automatically.
Create `app.json` in the root directory of your app

Expand All @@ -129,7 +129,7 @@ Create `app.json` in the root directory of your app
}
```

4. **Add checks**
##### 4. **Add checks**
This feature is rather nice, it makes Dokku check to make sure that your freshly uploaded code actually starts up before switching over to it!
Create a file called `CHECKS` in the root of your project directory

Expand All @@ -149,7 +149,7 @@ get '/check.txt', to: proc {[200, {}, ['it_works']]}

* And it will make a call to that route when it starts up your new code, thereby ensuring that the new server actually started.

5. **Add your secrets file**
##### 5. **Add your secrets file**

```ruby
# config/secrets.yml
Expand Down Expand Up @@ -179,17 +179,17 @@ production:
dokku config:set yourappname RAILS_MASTER_KEY=thehashstringfromyourmasterkeyfile
```
6. **Set up Puma correctly**
##### 6. **Set up Puma correctly**
If you are using Rails 6, [take a look at this post](https://www.alanvardy.com/posts/38) to save yourself some headache in getting Puma up and running.
7. **Add remote repository**
##### 7. **Add remote repository**
Navigate to your yourrailsapp project directory and add the repository
```git
git remote add dokku [email protected]:yourappname
```
8. **You can now push your code with**
##### 8. **You can now push your code with**
```git
git add .
Expand All @@ -201,13 +201,13 @@ git push dokku master
[Let's Encrypt](https://letsencrypt.org/) provides free SSL certificates. You can find more complete instructions and explanations here.
1. **SSH onto your server**
##### 1. **SSH onto your server**
```console
ssh [email protected]
```
2. **Install Let's Encrypt**
##### 2. **Install Let's Encrypt**
```console
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
Expand All @@ -219,19 +219,19 @@ dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
dokku plugin:update letsencrypt
```
3. **Set your email address** (note that you need to change MYAPP and [email protected])
##### 3. **Set your email address** (note that you need to change MYAPP and [email protected])
```console
dokku config:set --no-restart awesomeapp [email protected]
```
4. **Turn it on**
##### 4. **Turn it on**
```console
dokku letsencrypt yourappname
```
5. **Set up auto-renewal with a cronjob**
##### 5. **Set up auto-renewal with a cronjob**
```console
dokku letsencrypt:cron-job --add
Expand Down

0 comments on commit 2be82ec

Please sign in to comment.