How to upload files in root directory?

AI-generated summary

Users are discussing how to upload files to the root directory of a Discourse instance, primarily to integrate third-party push notification services like OneSignal and SendPulse. SMT seeks guidance on uploading SDK files for OneSignal, noting the official Discourse push plugin doesn’t support custom broadcasts or auto-subscription. Falco suggests using the existing Discourse push plugin, but Tom_Newsom clarifies its limited browser/device support. Falco questions the value of OneSignal given its own iOS limitations and notes Discourse already provides a manifest.json, which may conflict with custom setups. SMT confirms the plugin’s limitations. Mario faces the same issue with SendPulse and asks for next steps after entering the Docker container. iamntz provides a solution: configure Nginx to serve static files from a custom directory (e.g., /var/www/discourse-static) by adding location blocks in the Nginx config, then restarting Nginx. This avoids modifying the Discourse container directly, preserving changes across updates. The solution is noted as useful for cases where the Discourse plugin is too limited or requires manual user opt-in.

Hi, I am trying to integrate onesignal push notifications with discourse and it requires to upload some SDK files in root directory - Link.

Can anyone guide me on how to upload these files in root directory?

Discourse have a plugin to get push notifications already:

https://meta.discourse.org/t/discourse-push-notifications/46692?u=falco

But only for a subset of browsers and devices (and even then, not reliably)

@SMT - The “root” of your discourse instance lives inside the docker container. SSH in to your server and cd /var/discourse then ./launcher enter app. Trouble is, anything you store here will be wiped when you run an update.

One signal doesn’t support iOS also, so what’s the difference?

Also, discourse already supplies a manifest.json, so he will need to overthrown nginx/rails router. What are the pros?

There was me taking the iOS badge on the Onesignal front page at face value :smiley:

Hi, yes but currently with this plugin, I can’t send a custom push to all users that’s why I need to integrate onesignal. Also with the plugin can we automatically subscribe all users for push notifications?

did you solve the problem?

I want to add sendpulse files (https://sendpulse.com/features/webpush) to root directory but I have the same problem


I have to:

  1. Copy and paste code into your website template before the closing head tag

  2. Download the setup files below for the Chrome browser support. Unzip the archive and upload the files into the top-level directory ( root , or ‘/’) of your website.

So


cd /var/discourse then ./launcher enter app

What next?

Hey guys, a bit late at the party, but here is how I solved this:

  1. First step is to make your server to run nginx behind a proxy. You can find this right here.
  • mkdir -p /var/www/discourse-static
  1. On the nginx config file (/etc/nginx/sites-enabled/discourse.conf), just after location / {} block, add the following:
location ~ (file1.txt|file2.json|file3.zip) {
  root /var/www/discourse-static;
}

Save and check the config by running nginx -T. If everything is fine (i.e. a wall of text will quickly scroll), then you can go on and sudo service nginx restart.

And that’s all.


Discourse push plugin is a bit limited and requires users to actually know where to look and what to look for in order to enable notifications.