After this PR (https://github.com/tootsuite/mastodon/pull/6369) it appears the Docker instructions no longer work.
docker-compose run --rm web rake db:migrateIt migrates the DB.
PG::ConnectionBad: could not translate host name "db" to address: Name does not resolve
After I roll back that PR, it manages to connect to Postgres but I get a new error:
PG::ConnectionBad: fe_sendauth: no password supplied
I'm not sure if the last error is related or if there's some other step I'm missing.
master (If you're a user, don't worry about this).It works for me. The only difference as far as I know is that I'm on up-to-date Arch Linux. They should have different Docker versions and that can be a problem.
$ docker -v
Docker version 18.02.0-ce, build fc4de447b5
Please also make sure that you correctly merged your old configurations with the latest upstream configuration. I know a case that an administrator mistakenly removed networks section, which conflicted with volumes section edited by himself and that resulted in the same error.
Just tried updating to v2.3.0rc1 using the docker instructions and got the same error.
downgraded to v2.2.0, rebuilt, and everything works fine
it is an older docker version though. that must be the issue:
$ docker -v
Docker version 17.12.1-ce, build 7390fc6
Something odd happened... I cannot reproduce even on fresh Ubuntu 16.04. I created Ubuntu virtual machine with the following command:
virt-install --name ubuntu-server -r 2048 --vcpus 4 --nographics --disk path=ubuntu-server.qcow2,size=128,format=qcow2 --location http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu/dists/xenial/main/installer-amd64/ --extra-args console=ttyS0
And I commanded to the virtual machine:
wget -O - https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo vi /etc/apt/sources.list # add stable repository
sudo apt update
sudo apt install docker-ce git python-pip
pip install docker-compose
cd /
sudo git clone https://github.com/tootsuite/mastodon.git
cd mastodon
sudo cp .env.production.sample .env.production
sudo mkdir public/assets
sudo touch public/assets/500.html public/assets/sw.js # workaround https://github.com/docker/docker-py/issues/1841
sudo systemctl start docker
sudo ~/.local/bin/docker-compose build
sudo ~/.local/bin/docker-compose run --rm web rake secret
sudo ~/.local/bin/docker-compose run --rm web rake secret
sudo vi .env.production # fill PAPERCLIP_SECRET and SECRET_KEY_BASE, using keys generated by the last two commands
sudo ~/.local/bin/docker-compose run --rm web rake db:migrate
The installed version is 17.12.1-ce:
$ docker -v
Docker version 17.12.1-ce, build 7390fc6
I have no clue to resolve the problem now.
@akihikodaki the docker file has db persistence off by default I think. I wonder if that makes a difference. or maybe it is only caused on upgrades and not fresh installs?
I will try to experiment later tonight and try to get reproduction steps
@akihikodaki I also had no issue if I created a new vm and build master immediately.
I did reproduce it by first checking out v2.2.0, building that, then trying to build v2.3.0rc1
wget -O - https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo vi /etc/apt/sources.list # add stable repository
sudo apt update
sudo apt install docker-ce git python-pip
pip install docker-compose
cd /
sudo git clone https://github.com/tootsuite/mastodon.git
cd mastodon
###################
# This bit differs from steps you listed above
git checkout v2.2.0
sudo vi docker-compose.yml # un-comment the database persistence bit
###################
sudo cp .env.production.sample .env.production
sudo mkdir public/assets
sudo touch public/assets/500.html public/assets/sw.js # workaround https://github.com/docker/docker-py/issues/1841
sudo systemctl start docker
sudo ~/.local/bin/docker-compose build
sudo ~/.local/bin/docker-compose run --rm web rake secret
sudo ~/.local/bin/docker-compose run --rm web rake secret
sudo vi .env.production # fill PAPERCLIP_SECRET and SECRET_KEY_BASE, using keys generated by the last two commands
sudo ~/.local/bin/docker-compose run --rm web rake db:migrate
git stash
git checkout v2.3.0rc1
git stash pop
sudo vi docker-compose.yml # resolve merge errors
sudo ~/.local/bin/docker-compose build
sudo ~/.local/bin/docker-compose run --rm web rake db:migrate
@astronaut-wannabe Thanks for your report.
I confirmed that:
docker-compose run --rm does not remove dependency containers, including db.networks property is changed since it was built.The combination of the two behavior caused the problem. A suggested solution is to run the following command before executing docker-compose run:
docker-compose down
This removes the old container, and Docker will create a new one when you run docker-compose run next.
@Gargron Please note this when you write the release description for v2.3.0.
@akihikodaki thanks! docker-compose down worked and I was able to upgrade
Most helpful comment
@akihikodaki thanks!
docker-compose downworked and I was able to upgrade