Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
Tweak README slightly, and split out long deployment instructions to
separate file.
  • Loading branch information
bobwhitelock committed May 21, 2021
1 parent 240c138 commit 0b9d37a
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 86 deletions.
92 changes: 6 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

[![CI workflow badge](https://github.com/bobwhitelock/todotxt-ui/workflows/CI/badge.svg)](https://github.com/bobwhitelock/todotxt-ui/actions?query=workflow%3ACI)

## Development Notes
Developer-focused plain text todo list manager, using
[todo.txt](https://github.com/todotxt/todo.txt) format and Git for
storage/syncing. Currently very WIP.

Some steps may be missing ¯\\\_(ツ)\_/¯.
## To setup for development

```bash
git clone https://github.com/bobwhitelock/todotxt-ui.git
Expand All @@ -16,88 +18,6 @@ bin/rails server -b '0.0.0.0'
bin/webpack-dev-server # In separate shell.
```

## Deployment Notes
## To deploy

- Ubuntu 20.04 on Linode
- Dokku 0.23.2

### Updating Dokku

Where e.g. `version=v0.23.2`:

```bash
wget https://raw.githubusercontent.com/dokku/dokku/$version/bootstrap.sh
sudo DOKKU_TAG=$version bash bootstrap.sh
```

### To setup for deployment

Below took some bashing, so may be missing a step/need adjustment.

```bash
# Remote
dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku plugin:install https://github.com/michaelshobbs/dokku-hostname.git dokku-hostname
dokku plugin:install https://github.com/michaelshobbs/dokku-logspout.git
dokku plugin:install letsencrypt

dokku apps:create todotxt
dokku buildpacks:add todotxt https://github.com/heroku/heroku-buildpack-ruby.git
# Using specific version of buildpack as suggested to fix issue at
# https://github.com/heroku/heroku-buildpack-nodejs/issues/856. Apparently this
# has been fixed but can't figure out how to get this to work - see
# https://github.com/heroku/heroku-buildpack-nodejs/issues/856#issuecomment-731933169
dokku buildpacks:add todotxt 'https://github.com/heroku/heroku-buildpack-nodejs.git#v174'
dokku domains:add todotxt "$public_domain"
dokku domains:remove todotxt todotxt.li1514-40.members.linode.com
dokku letsencrypt:cron-job --add

ssh-keygen -t rsa -b 4096 -C "$email_for_app" -f ~/.ssh/id_rsa -N ''
# <add this to GitHub's https://github.com/settings/keys page>

dokku storage:mount todotxt /root/.ssh/:/app/.ssh
dokku storage:mount todotxt /var/lib/dokku/data/storage/todotxt/repo:/repo
mkdir -p /var/lib/dokku/data/storage/todotxt
cd !$
git clone "$todo_repo_url" repo # Where `$todo_repo_url` is `.git` version of URL.

dokku config:set todotxt \
AUTH_USER="$auth_user" \
AUTH_PASSWORD="$auth_password" \
TODO_FILE=/repo/"$path_to_todo_file" \
# This env var is for Git itself - see
# https://github.com/ruby-git/ruby-git/issues/386#issuecomment-416081185.
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i '/app/.ssh/id_rsa'" \
GIT_EMAIL="$email_for_app" \
[email protected]

dokku letsencrypt todotxt

# Setup database.
dokku postgres:create todotxt-database
dokku postgres:link todotxt-database todotxt
dokku run todotxt rake db:setup

# Configure logs to be sent to Papertrail - see
# http://mikebian.co/sending-dokku-container-logs-to-papertrail/.
dokku logspout:server syslog+tls://$papertrail_endpoint
dokku logspout:start
dokku ps:rebuildall
```

Also:
- Set up DNS to point to this instance at `$public_domain`


### To deploy

Deploys should happen automatically on push to `master` on GitHub, or can be
triggered manually locally like this:

```bash
git remote add prod dokku@$public_domain:todotxt
git push -f prod HEAD:master

# Any updates to `todotxt.crontab` locally will also need to be added to
# `/etc/cron.d/todotxt` remotely.
```
See [docs/deployment.md](docs/deployment.md).
94 changes: 94 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

# Deployment

This describes my current setup for deploying Todotxt UI, using
[Dokku](https://github.com/dokku/dokku).


## Versions

- Ubuntu 20.04 on Linode
- Dokku 0.23.2

### Updating

To update Dokku, where e.g. `version=v0.23.2`:

```bash
wget https://raw.githubusercontent.com/dokku/dokku/$version/bootstrap.sh
sudo DOKKU_TAG=$version bash bootstrap.sh
```


## To setup for deployment

Below has been gradually expanded as new steps are needed, and often required
some trial and error, so may be missing some steps or need adjustment.

```bash
# Remote
dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku plugin:install https://github.com/michaelshobbs/dokku-hostname.git dokku-hostname
dokku plugin:install https://github.com/michaelshobbs/dokku-logspout.git
dokku plugin:install letsencrypt

dokku apps:create todotxt
dokku buildpacks:add todotxt https://github.com/heroku/heroku-buildpack-ruby.git
# Using specific version of buildpack as suggested to fix issue at
# https://github.com/heroku/heroku-buildpack-nodejs/issues/856. Apparently this
# has been fixed but can't figure out how to get this to work - see
# https://github.com/heroku/heroku-buildpack-nodejs/issues/856#issuecomment-731933169
dokku buildpacks:add todotxt 'https://github.com/heroku/heroku-buildpack-nodejs.git#v174'
dokku domains:add todotxt "$public_domain"
dokku domains:remove todotxt todotxt.li1514-40.members.linode.com
dokku letsencrypt:cron-job --add

ssh-keygen -t rsa -b 4096 -C "$email_for_app" -f ~/.ssh/id_rsa -N ''
# <add this to GitHub's https://github.com/settings/keys page>

dokku storage:mount todotxt /root/.ssh/:/app/.ssh
dokku storage:mount todotxt /var/lib/dokku/data/storage/todotxt/repo:/repo
mkdir -p /var/lib/dokku/data/storage/todotxt
cd !$
git clone "$todo_repo_url" repo # Where `$todo_repo_url` is `.git` version of URL.

dokku config:set todotxt \
AUTH_USER="$auth_user" \
AUTH_PASSWORD="$auth_password" \
TODO_FILE=/repo/"$path_to_todo_file" \
# This env var is for Git itself - see
# https://github.com/ruby-git/ruby-git/issues/386#issuecomment-416081185.
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i '/app/.ssh/id_rsa'" \
GIT_EMAIL="$email_for_app" \
[email protected]

dokku letsencrypt todotxt

# Setup database.
dokku postgres:create todotxt-database
dokku postgres:link todotxt-database todotxt
dokku run todotxt rake db:setup

# Configure logs to be sent to Papertrail - see
# http://mikebian.co/sending-dokku-container-logs-to-papertrail/.
dokku logspout:server syslog+tls://$papertrail_endpoint
dokku logspout:start
dokku ps:rebuildall
```

Also:
- Set up DNS to point to this instance at `$public_domain`


## To deploy

Deploys should happen automatically on push to `master` on GitHub, or can be
triggered manually locally like this:

```bash
git remote add prod dokku@$public_domain:todotxt
git push -f prod HEAD:master

# Any updates to `todotxt.crontab` locally will also need to be added to
# `/etc/cron.d/todotxt` remotely.
```

0 comments on commit 0b9d37a

Please sign in to comment.