Trouble while upgrading docker


(Yoav Weiss) #1

While upgrading the docker image as indicated by the upgrade process in admin, I tried to follow the process outlines in How do I manually update Discourse and Docker image to latest? but hit the following error while running ./launcher rebuild app:

I, [2017-06-02T08:36:23.596063 #14]  INFO -- : > apt-get remove -y postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5
E: Sub-process /usr/bin/dpkg returned an error code (1)
I, [2017-06-02T08:36:26.039191 #14]  INFO -- : Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 26.1 MB disk space will be freed.
(Reading database ... 34469 files and directories currently installed.)
Removing postgresql-contrib-9.5 (9.5.7-1.pgdg16.04+1) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/9.5/man/man1/postmaster.1.gz because link group postmaster.1.gz is broken
update-alternatives: error: error creating symbolic link '/usr/share/man/man1/postmaster.1.gz.dpkg-tmp': No such file or directory
dpkg: error processing package postgresql-contrib-9.5 (--remove):
 subprocess installed pre-removal script returned error exit status 2
dpkg: postgresql-9.5: dependency problems, but removing anyway as you requested:
 postgresql-contrib-9.5 depends on postgresql-9.5 (= 9.5.7-1.pgdg16.04+1).

Removing postgresql-9.5 (9.5.7-1.pgdg16.04+1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Removing postgresql-client-9.5 (9.5.7-1.pgdg16.04+1) ...
Processing triggers for postgresql-common (182.pgdg16.04+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Errors were encountered while processing:
 postgresql-contrib-9.5



FAILED
--------------------
Pups::ExecError: apt-get remove -y postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5 failed with return #<Process::Status: pid 17 exit 100>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params "apt-get remove -y postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5"
6f0310973389d86ad7fba289ff678374967077c35de34060c4359bdb6cacfa6c
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

Is that a known issue? Could you point me to instructions for handling such cases?

Thanks in advance :slight_smile:
Yoav


Upgrade from v1.7.0.beta2
(Matt Palmer) #2

That shouldn’t be happening. What changes have you made to your app.yml?


(Yoav Weiss) #3

I didn’t perform any manual changes to my app.yml :expressionless:


(Yoav Weiss) #4

Here’s a copy of my app.yml with private info XXXed:

##
## After making changes to this file, you MUST rebuild for any changes
## to take effect in your live Discourse instance:
##
## /var/discourse/launcher rebuild app
##

## this is the all-in-one, standalone Discourse Docker container template
templates:
  - "templates/cron.template.yml"
  - "templates/postgres.9.3.template.yml"
  - "templates/redis.template.yml"
  - "templates/sshd.template.yml"
  - "templates/web.template.yml"

## which TCP/IP ports should this container expose?
expose:
  - "8080:80"   # fwd host port 80   to container port 80 (http)
  - "2222:22" # fwd host port 2222 to container port 22 (ssh)

params:
  ## Which Git revision should this container use?
  version: beta

env:
  ## How many concurrent web requests are supported?
  ## With 2GB we recommend 3-4 workers, with 1GB only 2
  UNICORN_WORKERS: 2
  ##
  ## List of comma delimited emails that will be made admin on signup
  DISCOURSE_DEVELOPER_EMAILS: 'XXX@XXXX.XXX'
  ##
  ## The domain name this Discourse instance will respond to
  DISCOURSE_HOSTNAME: 'discourse.wicg.io'
  ##
  ## The mailserver this Discourse instance will use
  DISCOURSE_SMTP_ADDRESS: smtp.sendgrid.net
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: XXXX@XXXX.XXX
  DISCOURSE_SMTP_PASSWORD: XXXXXXXXX
  ##
  ## the origin pull CDN address for this Discourse instance
  # DISCOURSE_CDN_URL: //discourse-cdn.example.com

## These containers are stateless, all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared

## The docker manager plugin allows you to one-click upgrade Discouse
## http://discourse.example.com/admin/docker
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-tagging.git

## Remember, this is YAML syntax - you can only have one block with a name
run:
  - exec: echo "Beginning of custom commands"

  ## If you want to configure password login for root, uncomment and change:
  #- exec: apt-get -y install whois # for mkpasswd
  ## Use only one of the following lines:
  #- exec: /usr/sbin/usermod -p 'PASSWORD_HASH' root
  #- exec: /usr/sbin/usermod -p "$(mkpasswd -m sha-256 'RAW_PASSWORD')" root

  ## If you want to authorized additional users, uncomment and change:
  #- exec: ssh-import-id username
  #- exec: ssh-import-id anotherusername

  - exec: echo "End of custom commands"
  - exec: awk -F\# '{print $1;}' ~/.ssh/authorized_keys | awk 'BEGIN { print "Authorized SSH keys for this container:"; } NF>=2 {print $NF;}'

(Daniela) #5

I had the same error months ago. You are running postgres 9.3 but Discourse wants postgres 9.5

Try to follow this

to see if it resolves

If it does not resolve do this


(Yoav Weiss) #6

Thanks! I’m running into the same catch22 reported here. I’m failing to rebuild with postgres9.3 and app.yml without it tell me that I need to upgrade by reverting to 9.3 and backing up…

Right now it’s not clear how do I get the app to run in order to be able to enter it and backup. Any assistance would be appreciated :slight_smile:


(Yoav Weiss) #7

Looks like the piece I was missing was replacing the instructions part where it says to rebuild as 9.3 with a simple ./launcher start app.
After that, I managed to enter the app container, back it up, upgrade and restore from backup.

One side effect is that a bunch of emails from a while ago got resent, but otherwise it seems like the upgrade went smoothly.


Upgrade from v1.7.0.beta2