Multisite configuration with Docker

docker

(Kane York) #68

It’s actually part of the YAML syntax for multiline strings.

Try running that snipped through a YAML validator, and you’ll see what I mean.


#69

I followed the instructions in this tutorial, which looks pretty much the same as described in the first post in here:

http://www.webhostbug.com/setup-multisite-discourse/

But i keep getting this error on the last step when i run ./launcher bootstrap web_only:

FAILED
——————–
RuntimeError: cd /var/www/discourse && sudo -E -u discourse bundle exec rake mul
tisite:migrate failed with return #
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn’
exec failed with the params “cd /var/www/discourse && sudo -E -u discourse bundl
e exec rake multisite:migrate”
794897b74ca52da8d6579596185cfc5a84b9aeceaca18c97ad26b6833fe268d3
FAILED TO BOOTSTRAP

Any ideas?

I also noticed this errors:

[2015-04-22T00:07:16.804505 #36]  INFO -- : > /usr/local/bin/ruby -e 'if ENV[
"DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not con
figured!"; exit 1; end'

/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.9.4/lib/bundler/spec_set.rb:92:in
`block in materialize': Could not find logster-0.8.0 in any of the sources (Bund
ler::GemNotFound)

This is my web_only.yml file:

# IMPORTANT: SET A SECRET PASSWORD in Postgres for the Discourse User
# webhostbug in this template

templates:
  - "templates/sshd.template.yml"
  - "templates/web.template.yml"

expose:
  - "80:80"
  - "2222:22"

# tests-passed is default
#params:
#  version: tests-passed

# developer emails allow you to fast track account creation on the site
env:
  # add emails here
  LANG: en_US.UTF-8
  DISCOURSE_DEVELOPER_EMAILS: 'blabla@gmail.com'
  DISCOURSE_DB_SOCKET: ''
  DISCOURSE_DB_PASSWORD: blabla
  DISCOURSE_DB_HOST: localhost
  DISCOURSE_HOSTNAME: 'blabla.website.com'
  DISCOURSE_REDIS_HOST: localhost
  # don't forget to set mail
  DISCOURSE_SMTP_ADDRESS: smtp.mandrillapp.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: blabla@mail.com
  DISCOURSE_SMTP_PASSWORD: bla-bla-some-api-key
  
volumes:
  - volume:
        host: /var/discourse/shared/data
        guest: /shared
  - volume:
        host: /var/discourse/shared/data/log/var-log
        guest: /var/log

# you may use the docker manager to upgrade and monitor your docker image
# UI will be visible at http://yoursite.com/admin/docker
hooks:
# you may import your key using launchpad if needed
#after_sshd:
#    - exec: ssh-import-id some-user
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git

#multisite
hooks:
  after_code:
    - file:
        path: /var/www/discourse/config/multisite.yml
        contents: |
         secondsite:
           adapter: postgresql
           host: localhost
           database: b_discourse
           username: discourse
           password: blabla
           pool: 25
           timeout: 5000
           db_id: 2
           host_names:
             - blabla.somesite2.com

    - exec:
        cd: /var/www/discourse/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
  after_web:
    - exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate

(Scott) #70

SOLVED! (for me at least)

Wowzer, this has been a lot to absorb, but I was able to get the multisite installation to finally work with a dev version and two production versions on the same server.

I totally understand where the gaps have been for those who are new to how this all works in relation to the way some may be used to dealing with Apache and PHP. I’m completely there with you, the way this all works is so different and there are a lot of assumptions made by those who understand all this. Not saying that is a bad thing, as it’s impossible for those who understand this to know what stage of knowledge new users are at.

While this is all fresh in my head (at my age retention is priceless) I would like to submit a write up on how I went about making this happen and the areas I got stuck. Hopefully this will help new people like me as I saw a lot of posts from others who I related to in their frustrations.

What would be the best thing for me to do? Should I add my experience to this topic, or should I create a new one, and in what category would be best for such a post? Or … should I just write up an article on my own site and then submit a post letting people know where to find it. (My preference is to add the post here)

Thank you … Pops


(Sam Saffron) #71

Feel free to post here, we can move to an appropriate place if it gets too long … or create a new topic. Up to you.


(Renoir Boulanger) #73

Also, under Ubuntu as a Host to run Docker, don’t forget to check if aufs is enabled.

# docker -D info
// ...
Storage Driver: aufs
```

Otherwise you can fix it by doing

apt-get install -yqq linux-image-extra-virtual aufs-tools


(dirkcuys) #74

I still haven’t figured out how to setup the firewall when using multiple containers. Is there a guide similar to this that explains how to setup ufw for a multi container setup?


(Tenzan) #75

Hello @sam,

This how-to, does it show how to separate them? Or is it just a recommendation?

If you showed how to separate, can you please point that snippet of the code?

Thanks.


(Brahn) #76

It looks like there might be an issue with multisite:migrate and assets:precompile since the change to the stylesheet cache was introduced.The problem has been discussed over here:

but I thought it might be worth bringing to the attention of this thread. Any ideas how to resolve it without editing web.template.yml?


(Tenzan) #77

Thanks, @brahn
I’ll take a look on that.


(Tenzan) #78

What specific .yml file do you mean? app.yml ?


(Sam Saffron) #79

look in the templates directory


(Tenzan) #80

There’re 12 template.yml files…


(Sam Saffron) #81

read them all if you want to find all the hooks


(Tenzan) #82

I just want to make 2 sites, so I’m looking for where I should edit for that.

I understand this is a bit complicated stuff, but having clear steps would be helpful. :wink:


(Sam Saffron) #83

If you want to run multisite follow this instructions in post #1

you are going to need advanced skills for this.


#84

If you’re confused on multisite and have the memory to spare, try two separate app.yml containers. There’s not much that needs to be changed, but you do need nginx on the host.


(Tenzan) #85

Sam,

I hope I’m not looking rude, I just want to say, if there’re detailed step by step instructions, it’s not so hard just to type the commands.

But if this is the way you want us to catch the idea from the rough steps, that’s another thing.


(Tenzan) #86

Thanks, but if possible I don’t want to escape just because it looks complicated :frowning:


#87

I personally think it’s the superior way. There seems to be issues with multisite. I’ve got it to work, but it didn’t feel right… like there might be issues down the road if things changed. My hosting is all 1 container setups. Your call. Goodluck.


(Tenzan) #88

Do you mean to install another standalone Discourse under /var/discourse2?