読者です 読者をやめる 読者になる 読者になる

MastodonをDB永続化忘れて起動したけど最小限の犠牲で済ませた

要はdocker psとdocker cp

hoge@ubuntu16:~/tmp/bk$ docker ps
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS                              NAMES
5b96312a6b26        mastodon_web         "bundle exec rails..."   About an hour ago   Up About an hour    0.0.0.0:3000->3000/tcp, 4000/tcp   mastodon_web_1
960bb0ec5396        mastodon_streaming   "npm run start"          28 hours ago        Up About an hour    3000/tcp, 0.0.0.0:4000->4000/tcp   mastodon_streaming_1
e5436243c18a        mastodon_sidekiq     "bundle exec sidek..."   28 hours ago        Up About an hour    3000/tcp, 4000/tcp                 mastodon_sidekiq_1
69e8481531c6        redis:alpine         "docker-entrypoint..."   28 hours ago        Up About an hour    6379/tcp                           mastodon_redis_1
8c5100e9fec4        postgres:alpine      "docker-entrypoint..."   28 hours ago        Up About an hour    5432/tcp                           mastodon_db_1
hoge@ubuntu16:~/tmp/bk$ docker cp mastodon_db_1:/var/lib/postgresql/data ./data

あとはdockr rm dbとかしてやればdocker-compose.ymlの設定が反映される

  db:
    restart: always
    image: postgres:alpine
### Uncomment to enable DB persistance
    volumes:
      - /path/to/postgres/data:/var/lib/postgresql/data

最小限の犠牲(3トゥートぐらい)ですんだ。
泥臭いですね!