Help us understand the problem. What is going on with this article?

Dockerで運用しているRedashをバージョンアップする

More than 1 year has passed since last update.

会社でdocker-composeで運用しているRedashをv3.0からv4.0にバージョンアップをした時のメモです。

まず公式サイトのHow to Upgradeを見てみました。

Docker
If you’re using Docker to run Redash, don’t use the upgrade script, but rather update the >Docker image you’re using.

Dockerのアップデートについの記述はこれだけです(笑)

  1. Make sure to backup your data. You only need to backup Redash's PostgreSQL database (the database Redash stores metadata in, not the ones you might be querying) as the data in Redis is transient.
  2. Update /opt/redash/docker-compose.yml Redash image reference to the one you want to upgrade to.
  3. Stop Redash services: docker-compose stop server scheduler scheduled_worker adhoc_worker (you might need to list additional services if you updated your configuration)
  4. Apply migration (if necessary): docker-compose run --rm server manage db upgrade
  5. Start services: docker-compose up -d

redash本体については、dockerイメージを更新すれば良いのですが、DBのマイグレートが必要なはずなので、updateスクリプトを読んでみました。

updateスクリプトを読み解いていくと、この行
でやっている以下の処理をやってあげれば良さそうです。

    run("sudo -u redash bin/run ./manage.py db upgrade", cwd=version_path(release.version_name))

では、それを踏まえてバージョンアップしていきます。
まずは、dockerイメージを更新するため、docker-compose.ymlのバージョンを書き換えます。

services:
  server:
    image: redash/redash:4.0.1.b4038
 (省略)
  worker:
    image: redash/redash:4.0.1.b4038

この状態で先ほど調べたDBマイグレートを行います。そうするとRedashのDockerイメージが更新され、DBがマイグレートされます。

# docker-compose run --rm server manage db upgrade

Starting redash_postgres_1 ... done
Starting redash_redis_1    ... done
Pulling server (redash/redash:4.0.1.b4038)...
4.0.1.b4038: Pulling from redash/redash
Digest: sha256:57c34a4c8a0232b10fddbd1fbd28370cc9c761befea2871130b4304279ffebb4
Status: Downloaded newer image for redash/redash:4.0.1.b4038
[2018-05-11 03:35:26,974][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2018-05-11 03:35:27,002][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
[2018-05-11 03:35:28,628][PID:1][INFO][root] Latest version: 4.0.1 (newer: False)
[2018-05-11 03:35:29,998][PID:1][INFO][alembic.runtime.migration] Context impl PostgresqlImpl.
[2018-05-11 03:35:29,998][PID:1][INFO][alembic.runtime.migration] Will assume transactional DDL.
[2018-05-11 03:35:30,020][PID:1][INFO][alembic.runtime.migration] Running upgrade d1eae8b9893e -> 7671dca4e604, empty message
[2018-05-11 03:35:30,040][PID:1][INFO][alembic.runtime.migration] Running upgrade 7671dca4e604 -> 5ec5c84ba61e, Add Query.search_vector field for full text search.
[2018-05-11 03:35:30,410][PID:1][INFO][alembic.runtime.migration] Running upgrade 5ec5c84ba61e -> 6b5be7e0a0ef, Re-index Query.search_vector with existing queries.
[2018-05-11 03:35:30,604][PID:1][INFO][alembic.runtime.migration] Running upgrade 6b5be7e0a0ef -> 969126bd800f, Update widget's position data based on dashboard layout.
Updating dashboards position data:
  Updating dashboard: 18
    Building widgets map:
    Widget: 80
    Widget: 81
    Iterating over layout:
      Row: 0 - [80, 81]
      Column: 0 - 80
      Column: 1 - 81
(途中省略)
  Updating dashboard: 6
    Building widgets map:
    Iterating over layout:
  Updating dashboard: 2
    Building widgets map:
    Iterating over layout:

あとはいつも通りredashを起動させれば完了です。古いコンテナは--remove-orphansで削除しました。

$ docker-compose up --remove-orphans
rakus
「IT技術で中小企業を強くします!」というミッションを掲げ、中小企業の業務効率化に貢献する複数のクラウドサービスを提供しているIT企業です。「楽楽精算」「メールディーラー」など、国内トップシェアを誇る複数のサービスを開発し、累計導入社数は5万社を超えています。次の時代の"楽"を創るための、まだ見ぬサービスや機能を生み出す取り組みは、今日も続いています。
https://www.rakus.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした