Install Discourse from Zip



I have installed Discourse with Docker in AWS and now I have the need to install it in an area that doesn’t have access to the internet. Is there a way to install Discourse and docker through the zip files? I do have access to a local repo, postgres,and mail server.

(Sam Saffron) #2

It will be pretty challenging and require quite a bit of technical knowhow. docker has an export command you can export images to tars, also you can download .deb files for installing docker.

But… piecing this all together will not be easy.

Simplest option would probably be to prepare it all upfront and then copy a backup of the disk onto a usb key and then ship that wherever.

(Eli the Bearded) #3

I can confirm Sam’s statement “piecing this all together will not be easy”. Much modern software expects the internet to be there and to work. Working around that is hard. I’d reword method for the “simplest option”, but it would amount to the same thing. Install everything somewhere with a network, transport that installed image to your air-gapped system.

But you do have a local email solution, right? Even if not connected to the wider internet? Discourse rather likes to associate users with email addressed.


I want to make sure I’m understanding you correctly. Install on a network with an internet connection. Docker has an export command that I can use to export the completely installed image to a zip file. Then use that to install it on the closed network. If that is correct, how difficult would it be to change hostnames and IPs?


I’m wondering if there is a response to this issue. I tried running ‘docker run -e DISCOURSE_DB_USERNAME=username image-id’ but it came back with error:

Already up-to-date.
I, [2017-02-15T18:35:39.055602 #13]  INFO -- : Loading --stdin
/pups/lib/pups/config.rb:23:in `initialize': undefined method `[]' for nil:NilClass (NoMethodError)
    from /pups/lib/pups/cli.rb:27:in `new'
    from /pups/lib/pups/cli.rb:27:in `run'
    from /pups/bin/pups:8:in `<main>'

(Rafael dos Santos Silva) #6

That’s strange. What image are you trying to run? It should be the local_discourse/app one I think.


No, It’s an image that I imported. So it gets a different name. I believe that I found another way.

To see the environment variables within the container, I ran:
docker inspect -f “{{ .Config.Env }}” image-id

Then to change the setting, I ran:
docker commit --change “ENV DISCOURSE_DB_USERNAME=username” container repository/tag

(Rafael dos Santos Silva) #8

I believe that you exported the wrong image.

And it’s working now?


It appears to be working now, though I’m getting the error:

Can’t chdir to ‘/shared/redis_data’: No such file or directory on the logs. so it doesn’t appear to be mounting the directory tree correctly.


Well, I decided to install redis locally and edited the app.yml file to point towards the host DISCOURSE_REDIS_HOST. I saved the image and loaded it and the entire /var/discourse directory struction into my closed environment only to get the following error when attempting to start it:

fatal unable to access server certificate verification failed. CAFile: etc/ssl/certs/ca-certificates.crt CRL file: none

I don’t understand why, if I’m not attempting to bootstrap or rebuild the application, the app is attempting to reach github for anything. The application already built, and is functioning, why are we reaching back to pups.git? And is there anyway to prevent it or have it look towards a local resource for the packages.

(Rafael dos Santos Silva) #11

If I do a docker images in my server I get:

root@vps0418:/var/discourse# docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
local_discourse/app    latest              663f686a956c        2 hours ago         2.358 GB
discourse/base         release             32625cae33a5        15 hours ago        1.629 GB
<none>                 <none>              59ff72b2a7e5        10 days ago         2.432 GB
<none>                 <none>              496a8192e72d        4 weeks ago         2.414 GB
<none>                 <none>              8b65db07e448        8 weeks ago         2.283 GB
discourse/discourse    1.3.10              1881a9bd3afd        8 weeks ago         1.539 GB
abiosoft/caddy         latest              8c9cc3d5644a        9 weeks ago         41.34 MB
samsaffron/docker-gc   latest              54ca424ca8d6        16 months ago       57.66 MB

The one that you want to export is local_discourse/app


That is the image that I imported. I made sure to take the image specified as “latest”.
docker save -o “image.tar” "image-id"
Copied the tar file to a DVD to transport to new environment.
I then ran docker load -i “image.tar” on the new host.
Used ‘docker commit --change “ENV”’ to make the needed environment changes.
Ran “docker images” to get the new latest image id.
Then ran ‘docker create -t -i --name “new-container-name” “latest-image-id”’ to create a new container with those changes.
docker start “new_container_name” resulted in the above error in the docker container log file

(Rafael dos Santos Silva) #13

Are you running it with something like:

docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=2 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_S
IZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e COMPRESS_BROTLI=true -e -e -e -e DISCOURSE_SMTP_PORT=2525 -e DISCOURSE_SMTP_USER_NAME=SMTP_User -e DISCOURSE_SMTP_PASSWORD=verylongpassword -h hostname-app -e DOCKER_HOST_IP= --name app -t -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 00:11:22:33:44:55 local_discourse/app /sbin/boot


I am not, but I will definitely try that if you think it’ll make a difference. Can that command be used to change the environment variables in one command or should I run the “commit” command first?

(Rafael dos Santos Silva) #15

I believe the the “-e” will set any env variable you need.


Ok. I will give that a try. Thank you!


I think that something about the syntax is out of order because I’m getting the error:
/usr/bin/docker-current: Error response from daemon: invalid header field value “oci runtime error: container_linux.go:247: starting container process caused “exec:\”-e\”:executable file not found in $PATH"\n"