Improve docker update instructions (#1619)

This commit is contained in:
Eugen 2017-04-12 19:34:40 +02:00 committed by GitHub
parent c4baa9fb6b
commit e17b5b228d
1 changed files with 18 additions and 25 deletions

View File

@ -69,28 +69,27 @@ Consult the example configuration file, `.env.production.sample` for the full li
The project now includes a `Dockerfile` and a `docker-compose.yml` file (which requires at least docker-compose version `1.10.0`). The project now includes a `Dockerfile` and a `docker-compose.yml` file (which requires at least docker-compose version `1.10.0`).
Review the settings in docker-compose.yml. Note that it is not default to store the postgresql database and redis databases in a persistent storage location, Review the settings in `docker-compose.yml`. Note that it is not default to store the postgresql database and redis databases in a persistent storage location,
so you may need or want to adjust the settings there. so you may need or want to adjust the settings there.
Before running the first time, you need to build the images: Before running the first time, you need to build the images:
docker-compose build docker-compose build
Then, you need to fill in the .env.production file: Then, you need to fill in the `.env.production` file:
cp .env.production.sample .env.production cp .env.production.sample .env.production
vi .env.production nano .env.production
Do NOT change the REDIS_* or DB_* settings when running with the default docker configurations. Do NOT change the `REDIS_*` or `DB_*` settings when running with the default docker configurations.
You will need to fill in, at least: You will need to fill in, at least: `LOCAL_DOMAIN`, `LOCAL_HTTPS`, `PAPERCLIP_SECRET`, `SECRET_KEY_BASE`, `OTP_SECRET`, and the `SMTP_*` settings. To generate the `PAPERCLIP_SECRET`, `SECRET_KEY_BASE`, and `OTP_SECRET`, you may use:
LOCAL_DOMAIN, LOCAL_HTTPS, PAPERCLIP_SECRET, SECRET_KEY_BASE, OTP_SECRET, and the SMTP_*
settings. To generate the PAPERCLIP_SECRET, SECRET_KEY_BASE, and OTP_SECRET, you may use:
docker-compose run --rm web rake secret docker-compose run --rm web rake secret
Do this once for each of those keys, and copy the result into the .env.production file in Do this once for each of those keys, and copy the result into the `.env.production` file in the appropriate field.
the appropriate field.
Then you should run the db:migrate command to create the database, or migrate it from an older release: Then you should run the `db:migrate` command to create the database, or migrate it from an older release:
docker-compose run --rm web rails db:migrate docker-compose run --rm web rails db:migrate
@ -98,7 +97,7 @@ Then, you will also need to precompile the assets:
docker-compose run --rm web rails assets:precompile docker-compose run --rm web rails assets:precompile
before you can launch the docker image with: before you can launch the docker image with:
docker-compose up docker-compose up
@ -106,10 +105,10 @@ If you wish to run this as a daemon process instead of monitoring it on console,
docker-compose up -d docker-compose up -d
Then you may login to your new Mastodon instance by browsing to http(s)://(yourhost):3000/ Then you may login to your new Mastodon instance by browsing to http://localhost:3000/
Following that, make sure that you read the [production guide](docs/Running-Mastodon/Production-guide.md). You are probably going to want to understand how Following that, make sure that you read the [production guide](docs/Running-Mastodon/Production-guide.md). You are probably going to want to understand how
to configure NGINX to make your Mastodon instance available to the rest of the world. to configure Nginx to make your Mastodon instance available to the rest of the world.
The container has two volumes, for the assets and for user uploads, and optionally two more, for the postgresql and redis databases. The container has two volumes, for the assets and for user uploads, and optionally two more, for the postgresql and redis databases.
@ -133,17 +132,11 @@ Running any of these tasks via docker-compose would look like this:
This approach makes updating to the latest version a real breeze. This approach makes updating to the latest version a real breeze.
git pull 1. `git pull` to download updates from the repository
2. `docker-compose build` to compile the Docker image out of the changed source files
To pull down the updates, re-run 3. (optional) `docker-compose run --rm web rails db:migrate` to perform database migrations. Does nothing if your database is up to date
4. (optional) `docker-compose run --rm web rails assets:precompile` to compile new JS and CSS assets
docker-compose build 5. `docker-compose up -d` to re-create (restart) containers and pick up the changes
And finally,
docker-compose up -d
Which will re-create the updated containers, leaving databases and data as is. Depending on what files have been updated, you might need to re-run migrations and asset compilation.
## Deployment without Docker ## Deployment without Docker
@ -159,7 +152,7 @@ Docker is great for quickly trying out software, but it has its drawbacks too. I
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
Mastodon can theoretically run indefinitely on a free [Heroku](https://heroku.com) app. [You can view a guide for deployment on Heroku here.](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Heroku-guide.md) Mastodon can run on [Heroku](https://heroku.com), but it gets expensive and impractical due to how Heroku prices resource usage. [You can view a guide for deployment on Heroku here](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Heroku-guide.md), but you have been warned.
## Development with Vagrant ## Development with Vagrant