Discourse Docker Image version 1.3.3, released


(Sam Saffron) #1

We just released a new Discourse docker image (1.3.3), to update run:

cd /var/discourse
git pull
./launcher rebuild app
# rebuild will upgrade the database and exit
./launcher rebuild app

This image includes a very large amount changes:

  • We upgraded Postgres from version 9.3 to version 9.5 (which should be seamless for the vast majority)

  • We updated our base Ubuntu image from 14.04 LTS to 16.04 LTS, this means that on May 31st Google will no longer disable HTTP/2 on your site.

  • We upgraded Ruby from 2.0 to 2.3.1, this results in slightly better perf, similar memory usage and slightly reduced CPU usage.

  • We upgraded many internal components including ImageMagick, libpng, phantomjs, NGINX and so on

  • We applied all the latest security patches from Ubuntu

We strongly recommend upgrading your self hosted instances now, in 14 days I will amend docker-manager to disallow web upgrades until image is upgraded to latest.

If anyone is experiencing upgrade issues, let us know

:heart: :confetti_ball:

Do I need to upgrade linux on my server?

There is no need to upgrade the host running the Docker images. Our pre-req checks ensure you are running a supported version of Docker.

Trouble upgrading PostgreSQL

On some very old images of Discourse the automatic pg upgrade may fail. If this happens the upgrader will display the commands you need to run to get up and running. In a nutshell you need to “backup” your db to a folder and then restore it from the folder into the new version. Alternatively, you can amend your template to run against pg 9.3


After upgrade fail site /admin and forum not accesible
Missing /shared/postgres_data and redis_data after upgrade
Launcher cleanup's fs download doesn't seem to count?
Mistakes when upgrading docker image to 1.3.3
Blank Page after Upgrading due to old Tagging Plugin
Failed to bootstrap 1.6.0.beta 8 with out of date docker
What version of Postgres should I be using on 1.6+
Update Button Missing?
Something seems to have gone wrong with my update
Discourse fails to rebuild after changed SMTP password because of Postgres
Onebox works for linked PDF's but not uploaded PDF's, is that correct?
Trouble upgrading PostgreSQL from 9.3 to current
(Sam Saffron) #4

#5

It failed.

Asked me to run ./launcher bootstrap app


./launcher bootstrap app completed.


Running ./launcher rebuild app completed.

Site fully funtional.

I do have this showing up on admin page.

Discourse running on Unbuntu 16.04


Tuning Ruby and Rails for Discourse
(Yoav Weiss) #6

Fails for me as well, saying that the postgres upgrade failed and that I’d have to export my data into a clean instance :confused:

Exact message I’m getting is:

encodings for database "postgres" do not match:  old "SQL_ASCII", new "UTF8"
Failure, exiting
-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES FAILED


Add the line: base_image: "discourse/discourse:1.0.17"
Change: templates/postgres.template.yml TO templates/postgres.9.3.template.yml

Run ./launcher rebuild app again

When your instance is running:
Run ./launcher enter app
Run cd /shared/postgres_backup && sudo -u postgres pg_dump discourse > backup.db

Undo the base_image and postgres template from your container config
Run: ./launcher stop app
Run: sudo mv /var/discourse/shared/postgres_data /var/shared/postgres_data_old
Run: ./launcher rebuild app

Run: ./launcher enter app
Run: cd /shared/postgres_backup
Run: sv stop unicorn
Run: sudo -iu postgres dropdb discourse
Run: sudo -iu postgres createdb discourse
Run: sudo -iu postgres psql discourse < backup.db
Run: exit
Run: ./launcher rebuild app

I’m not sure where the base_image line should be added. Any assistance would be highly appreciated.


(Sam Saffron) #7

I will fix that message, it is no longer correct as of Ruby 2.3


Tuning Ruby and Rails for Discourse
(Dave Higgins) #8

Thanks for these changes - can you advise me on the OS of the host server itself please?
I run a DigitalOcean Ubuntu 14.04 LTS. Do I need to apt-get dist-upgrade that first?
It may be I am confused as to what runs in the docker app and what runs “underneath”.


#9

mine failed as well - tried to bootstrap app but just had to rebuild app again and worked its way through.


(Marco) #10

I issued another rebuild and… it worked.


(Marco) #11

Hey it’s way faster!


#12

I also noticed this.

Much faster loading times overall.


(Sam Saffron) #13

I just fixed the instructions, no need to add the base image. Let me know how you go.

Sorry this happened, how old is your Discourse install?


(Sam Saffron) #14

Added a note to the OP, no need to upgrade the host.


(@SenpaiMass) #15

So do i need to upgrade my Ubuntu version from 14.04 to 16.04?

via terminal command

sudo do-release-upgrade -d

(Régis Hanol) #16

Sam just said that you don’t need to update the host.


(Erick Guan) #17

Multi-container, same approach for data container. web container has problems connecting redis in data container.

Failed to report error: Error connecting to Redis on data:6379 (Errno::ECONNREFUSED) 2 Error connecting to Redis on data:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:345:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:331:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:101:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:293:in `with_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:100:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:276:in `with_socket_timeout'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:133:in `call_loop'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:43:in `subscription'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:12:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:2760:in `_subscription'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:2138:in `block in subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `block in synchronize'", "/usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:2137:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus/backends/redis.rb:304:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:504:in `global_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:456:in `block in new_subscriber_thread'"] 
URGENT: Error connecting to Redis on data:6379 (Errno::ECONNREFUSED) Failed to initialize site default
Failed to report error: Error connecting to Redis on data:6379 (Errno::ECONNREFUSED) 2 Error connecting to Redis on data:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:345:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:331:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:101:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:293:in `with_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:100:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:276:in `with_socket_timeout'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:133:in `call_loop'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:43:in `subscription'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:12:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:2760:in `_subscription'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:2138:in `block in subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `block in synchronize'", "/usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis.rb:2137:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus/backends/redis.rb:304:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:504:in `global_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:456:in `block in new_subscriber_thread'"] 

Testing:

  before_code:
    - exec: gem install redis
    - exec: /usr/local/bin/ruby -e 'require "redis"; redis = Redis.new({:host=> "data", :port=> 6379}); p redis; p redis.ping'
    - exec:
        cmd:
          - cat /etc/hosts
          - exit 1

Results:

I, [2016-05-25T11:28:07.314311 #15]  INFO -- : > gem install redis
I, [2016-05-25T11:28:09.567452 #15]  INFO -- : Successfully installed redis-3.3.0
1 gem installed

I, [2016-05-25T11:28:09.568287 #15]  INFO -- : > /usr/local/bin/ruby -e 'require "redis"; redis = Redis.new({:host=> "data", :port=> 6379}); p redis; p redis.ping'
/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:345:in `rescue in establish_connection': Error connecting to Redis on data:6379 (Errno::ECONNREFUSED) (Redis::CannotConnectError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:331:in `establish_connection'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:101:in `block in connect'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:293:in `with_reconnect'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:100:in `connect'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:364:in `ensure_connected'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:221:in `block in process'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:306:in `logging'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:220:in `process'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:120:in `call'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:149:in `block in ping'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `block in synchronize'
	from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `synchronize'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:148:in `ping'
	from -e:1:in `<main>'
I, [2016-05-25T11:28:09.722237 #15]  INFO -- : #<Redis client v3.3.0 for redis://data:6379/0>

Redis is not configured right. IP address fails either


Update: comment bind to allow redis bind all, then should be fine. Yes, confirmed it’s working.


(Yoav Weiss) #18

Thanks, I got it going. Regarding the instructions, it would have been helpful to state that the changes need to go into app.yml
I managed to grep my way out of it, but for people not familiar with docker, that’s not obvious.

I’m not sure how old was my discourse install tbh, but it shouldn’t have been that old. I upgrade it on a regular basis.


#19

Running an old system and planning to upgrade today. Would like to understand in advance what we could be facing into if we need to do this - can you elaborate ?


(Uwe Keim) #20

I’ve misread this one and copied my “templates/postgres.template.yml” over my “templates/postgres.9.3.template.yml”.

Any chance to get the original “templates/postgres.9.3.template.yml” back again?

Update:

Got it from here


(Ludovic Bellier) #21

Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-86-generic x86_64)

sudo git pull
sudo ./launcher rebuild app

FAILED
--------------------
RuntimeError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 74 exit 2>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
483ef7f997c9066387114808e2661f1e04beadaaee269f637dada8772838ec50
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

sudo ./launcher rebuild app
same error ; again and again

trying to use the 9.3 postgres template and to bootstrap app

images was built
container was built and launched

nginx is not very happy so it says bad gateway
2016/05/25 14:22:34 [error] 45#45: *1 connect() failed (111: Connection refused) while connecting to upstream, client: X.X.X.X, server: _, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:3000/", host: "XXX.YYY.ZZ"

have to remove all images, all containers, bootstrap app and launch app ; finally it works (with postgres 9.3)


(Alan Tan) #22

please scroll up and look for earlier error messages

Do you see anything else? It’ll help us to debug your problem.