Ghost Discourse integration

AI-generated summary

Craigs is trying to integrate Ghost (version 4.6.4) and Discourse (version 2.8.0.beta1) using Traefik as a reverse proxy. Despite following tutorials and configuring DiscourseEmbed, no comments are displayed on the Ghost page. The script appears to be executing, but returns no comments. The Discourse instance is in bootstrap mode with barely any topics. Craigs has added DISCOURSE_ENABLE_CORS: true to app.yml and configured CORS origins, but the issue persists.

I am grappling with establishing an integration between Ghost and Discourse.

Discourse is: 2.8.0.beta1, docker on Ubuntu - no nginx

I’m using traefik on a standalone system behind a single ip router - in a natted home lan. Traefik allows http/s routing.

Traefik is configured with a traefik_dynamic.toml rather than docker labels. There is no shared docker network. (If anyone is interested in the traefik config - please ping me - it works quite nicely as a reverse proxy).

Ghost is also the latest version ( 4.6.4) and runs on a separate host (both hosts are ubuntu VMs- VERSION="20.04.2 LTS (Focal Fossa), running on proxmox.

I have followed the variety of tutorial pages that are available on Ghost Doc site and Discourse forum.

Firefox web developer tools indicate that the page returns the following page source:

<div class="comment container small">

<div class="discourse-comments"></div>
    <script type="text/javascript">
     if (window.location.pathname.indexOf('/p/') < 0) {
      DiscourseEmbed = { discourseUrl: 'https://discourse.mydomain/', discourseEmbedUrl: 'https://ghost.mydomain/testing-new-stuff/' };

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();
}
</script>
</div>

But no actual comments are returned. I can see that my discourse host returns embed.js but nada on the page. (sorry I’m not a web developer person).

So it seems that the script is getting through and returning nothing

Its a new discourse install and its still on training wheels (bootstrap mode). So there are hardly any topics yet

app.yml is appended below.

embedded host settings are ok I believe with discourse adminuser as username for topic creation, path allowlist is currently “”
I created a category testing and it is added to the Post to category.

Also added DISCOURSE_ENABLE_CORS: true to app.yml because that might help. I added the proxy and http://ghost.mydomain and http://ghost.mydomain to the cors origins.

Anybody able to offer advice on how might I debug this?

app.yml:
#
templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
#  - "templates/web.ssl.template.yml"
#  - "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "8081:80"   # http
    #  - "443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "2048MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

env:
 LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en

  DISCOURSE_ENABLE_CORS: true

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  UNICORN_WORKERS: 2

  ## TODO: The domain name this Discourse instance will respond to
  ## Required. Discourse will not work with a bare IP number.
  DISCOURSE_HOSTNAME: mydiscoursehost.mydomain

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'myemailaddress@mydomain'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  # SMTP ADDRESS, username, and password are required
  # WARNING the char '#' in SMTP password can cause problems!
  DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: postmaster@mydomain
  DISCOURSE_SMTP_PASSWORD: "mypostmasterpassword7"
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
  DISCOURSE_SMTP_DOMAIN: mydomain
  DISCOURSE_NOTIFICATION_EMAIL: noreply@mydomain

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  #  LETSENCRYPT_ACCOUNT_EMAIL: notused

  ## The http or https CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com
 
  ## The maxmind geolocation IP address key for IP address lookup
  ## see https://meta.discourse.org/t/-/137387/23 for details
  #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  - exec: echo "End of custom commands"