Quantcast
Channel: Discourse Meta - Latest topics
Viewing all 60613 articles
Browse latest View live

Enable a CDN for your Discourse

$
0
0

Jeff Atwood wrote:

So you'd like to use a CDN to speed up worldwide access to common assets on your Discourse forum?

Sign up with the CDN of your choice. The configuration will look something like this:

What you're looking for is three main settings:

  1. The origin address, which is the URL where your forum is currently located discourse.example.com. This is where the CDN will draw all its original content from on first request.

  2. The CNAME, which is the "friendly" name for your CDN that you'll set up in your DNS, e.g. discourse-cdn.example.com

  3. The CDN URL, which is the "unfriendly" name for where the cached CDN assets will be coming from via the CDN's worldwide network of distributed servers. It will look like 637763234.cdn-provider.com

You'll need to edit your DNS to map the CNAME to the CDN URL, like so:

discourse-cdn.example.com IN CNAME 637763234.cdn-provider.com

(Once you've edited the DNS, give it a little bit of time to propagate.)

The actual Discourse part of the setup is fairly simple. Uncomment the CDN line in your app.yml and update it with the CNAME you just set up in your DNS:

## the origin pull CDN address for this Discourse instance
DISCOURSE_CDN_URL: //discourse-cdn.example.com

(If you do not see this line in your app.yml, add it below the other DISCOURSE_ variables)

As with any other changes to your app.yml, you need to rebuild the container to reflect changes:

./launcher rebuild app

Once you've rebuilt, browse to your Discourse instance in the browser. View source and search for "cdn". You'll see that websites assets are now coming from your CDN:

<script src="http://discourse-cdn.codinghorror.com/assets/preload_store-4ea79c2f435becca86ac97a9c038f9c7.js"></script>
<script src="http://discourse-cdn.codinghorror.com/assets/locales/en-7084a68855205a9128245d2d0ce94ed9.js"></script>

Posts: 11

Participants: 5

Read full topic


Allowing SSL for your Discourse Docker setup

$
0
0

Sam Saffron wrote:

So you'd like to enable SSL for your Docker-based Discourse setup? Let's do it!

This guide assumes you used all the standard install defaults -- a container configuration file at/var/docker/containers/app.yml and Discourse docker is installed at: /var/docker

Buy a SSL Certificate

Go to namecheap or some other SSL cert provider and purchase a SSL cert for your domain. Follow all the step documented by them to generate private key and CSR and finally get your cert. I used the apache defaults, they will work fine.

Keep your private key and cert somewhere safe.

Place the Certificate and Key

Get a signed cert and key and place them in the /var/docker/shared/standalone/ssl/ folder

Private key is:

/var/docker/shared/standalone/ssl/ssl.key

Cert is

/var/docker/shared/standalone/ssl/ssl.crt

File names are critical do not stray from them or your nginx template will not know where to find the cert.

Have a look at your app.yml configuration file to see where the shared folder is mounted.

volumes:
  - volume:
      host: /var/docker/shared/standalone
      guest: /shared

In essence the files must be located at /shared/ssl/ssl.key /shared/ssl/ssl.crt inside the container.

Configure NGINX

Add a reference to the nginx ssl template from your app.yml configuration file:

templates:
  - "templates/cron.template.yml"
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/sshd.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ssl.template.yml"

Configure your Docker Container

Tell your container to listen on SSL

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

Bootstrap your Docker Container

Rebuild your app

./launcher rebuild app

Profit, you are done!

Troubleshooting

Be sure to read through the logs using

./launcher logs app

If anything goes wrong.

How this works

The template used is vaguely based on @igrigorik's recommended template with two missing bits:

  • I skipped OSCP stapling cause it involves a slightly more complex setup
  • I had to skip session tickets setting which is not available until we use mainline

The image has rewrite rules that will redirect any requests on either port 80 or 443 to https://DISCOURSE_HOST_NAME , meaning that if you have a cert that covers multiple domains they can all go to a single one.

Customising this setup is very easy, see:

You can make a copy of that file and amend the template as needed.

The advantage of using templates and replace here is that we get to keep all the rest of the Discourse recommended NGINX setup, it changes over time.

Enjoy!

Posts: 44

Participants: 17

Read full topic

Easy way to display images in full resolution?

$
0
0

Franz wrote:

Hi,

Is there a way for a user to display an image in full resolution without having to open the image in a different tab/window?

Franz

Posts: 14

Participants: 4

Read full topic

Make share button public

$
0
0

Barnabas wrote:

Hi, I noticed that the Facebook, Twitter and other social share buttons are only available to signed up users. Can the "Share" button be made public so that visitors who are not signed up can still share discussion to Facebook, Twitter. Thanks

Posts: 19

Participants: 8

Read full topic

Advanced Setup and Administration

$
0
0

Arpit Jalan wrote:

Here are some of the more advanced Discourse setup and administration questions we see:

How can I enable Cross-origin Resource Sharing with Docker?

Modify these settings in app.yml file:

DISCOURSE_ENABLE_CORS: true
DISCOURSE_CORS_ORIGIN: '*'

Now rebuild the container:

cd /var/docker
./launcher rebuild app

This will enable Cross-origin Resource Sharing on your Discourse instance.

How can I use Nginx alongside the Discourse Instance?

Change the port the docker container binds to in app.yml to something other than 80; and then in your nginx install set up http forwarding to direct to this alternate port. Follow the steps for installing normally until you reach ./launcher bootstrap app

  • Edit app.yml to bind to a port other than port 80 externally. Pick something that is not in use (maybe 4578?)

 - "4578:80"   # fwd host port 4578   to container port 80 (http)
  • Continue with the steps above (bootstraping, starting), and verify that you can see discourse on the alternate port. Use your server IP as above, and add in the port you chose. For example: http://8.8.8.8:4578 if your server IP was 8.8.8.8.

  • Configure your current nginx install to proxy_pass to the docker container. Here is an example of something you can include in sites-enabled.

  • Remember to restart your external nginx.

How can I change Upload Maximum value?

Add this text to your app.yml after - exec: echo "Beginning of custom commands":

  - replace:
      filename: "/etc/nginx/conf.d/discourse.conf"
      from: /client_max_body_size.+$/
      to: client_max_body_size XXm;

Change XX to any amount of megabytes you want. Then rebuild your container with

./launcher rebuild app

How can I completely wipe my Discourse Instance?

If you want to destroy your entire Discourse instance data, and want to start fresh:

rm -rf /var/docker/shared*

I can't upgrade my Docker based Discourse instance. Any workaround?

Try doing this:

cd /var/docker
git pull
./launcher rebuild app

How can I upgrade Docker on my Ubuntu server?

Run these commands:

apt-get update
apt-get dist-upgrade
apt-get upgrade lxc-docker

How can I set-up automatic security updates in Ubuntu?

Run this command:

dpkg-reconfigure -plow unattended-upgrades

How can I set-up email notification of other Ubuntu updates?

apt-get install sendmail
apt-get install apticron
nano /etc/apticron/apticron.conf

(change EMAIL to youremail@address.com)

My Docker container is low on Disk Space. How can I clean up old Docker containers?

A quick way to recover space

docker images --no-trunc| grep none | awk '{print $3}' | xargs -r docker rmi

How can I install Plugins?

To install a plugin in Discourse, it needs to be placed in /var/www/discourse/plugins. However, this is inside the container - and changes to the container are wiped when it is rebuilt! So, the container definition is what needs to be edited.

There's already a template in the app.yml file for installing plugins due to the docker_manager plugin, so just add your plugin on the end!

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-spoiler-alert.git
          - git clone https://riking-discourse:insecurepassword@bitbucket.org/riking/some-private-plugin.git

Posts: 9

Participants: 6

Read full topic

Keyboard shortcuts wish list

$
0
0

TechnoBear wrote:

Keyboard shortcuts to the Profile page and Hamburger menu would be greatly appreciated. The Hamburger menu is much easier to navigate for non-mouse-users than the Categories page.

Posts: 8

Participants: 4

Read full topic

Introducing Discourse 1.0

$
0
0

Jeff Atwood wrote:

Today we are incrementing the version number of Discourse to 1.0.

We've been working on Discourse in public for about a year and a half now – since February 2013. Turns out that's about how long it takes to herd an open source project from "hey, cool toy" to something that works for most online discussion communities.


This topic is for comments on the original blog entry at: http://blog.discourse.org/2014/08/introducing-discourse-1-0/

Posts: 21

Participants: 19

Read full topic

How to update to Discourse 1.0?

$
0
0

Sam Saffron wrote:

Now that Discourse 1.0 is released, you're wondering how to update your existing Discourse installation to the first non-beta release.

Move discourse docker from /var/docker to /var/discourse

Our official location for docker install has moved, we recommend you keep your install in /var/discourse as opposed to /var/docker

cd /var/docker
./launcher stop app
nano containers/app.yml     # edit all refs to /var/docker to /var/discourse
cd /
mv /var/docker /var/discourse

Update Docker

The latest version of Docker contains many urgent fixes, most notably, restart policies ensure your Discourse image will come back to life after a reboot.

apt-get update
apt-get dist-upgrade lxc-docker

Ensure you are tracking the desired Discourse branch

Discourse has 3 official branches:

  1. tests-passed: updated most frequently after our test suite runs. This is the branch we deploy most of our customers on.
  2. beta: updated weekly, a snapshot of tests-passed.
  3. stable: where our major releases live (with security fixes backported as they arise)

Pick your desired branch

params:
   version: tests-passed # or beta or stable

Update to the latest Docker image

Our newest Docker image resolves quite a few issues (log rotation, syslog works correctly, permissions, security), we strongly recommend you upgrade.

cd /var/discourse
git pull
./launcher rebuild app

Posts: 4

Participants: 3

Read full topic


Configuring a CDN in Bitnami install

Does discourse support both SSL and TLS encrypted SMTP?

Max image size VS max attachment size

$
0
0

Anton wrote:

What's the difference between max image size kb and max attachment size kb site settings?
What is used where? It is not obvious from the settings page.

Posts: 2

Participants: 2

Read full topic

Triggered custom badge queries

$
0
0

Sam Saffron wrote:

When defining badges there is this beguiling box "Trigger" with the options:

  • Update daily
  • When a user acts on a post
  • When a user edits or creates a post
  • When a user changes trust level
  • When a user is edited or created

The trigger forces badges to run at an interval that is more frequent than daily. We use these triggers in our badges. They ensure users are notified of new badges closer to the time the action happened.

2 types of badges

When defining badges you can choose 1 of the 2 flavors, badge that targets posts or a badge that does not.

All badge SQL definitions always require you select the columns user_id and granted_at.

If your badge targets posts you must also select a column named post_id

sometimes these columns are not available, just alias them eg: u.id as user_id

Triggered badges have 2 extra constraints

Since triggered badges can run once a minute, we require you provide more "hinting" in the badge definition. It is not enough to return the full set of badges, you must also provide hinting about how to execute the badge on a subset.

If your trigger is user based, you must supply a clause on how to filter it base on :user_ids, if your trigger is post based, you must supply information on how to trigger it based on :post_ids

Since daily a full backfill runs regardless you must take that into consideration and include handling of the :backfill parameter.

So, you query triggered badge query will always include the :backfill param and either the :post_ids param or :user_ids param.

An example

The following badge is triggered on "when a user acts on a post", this means "delta" applications will get the :post_ids parameter.

SELECT p.user_id, p.id post_id, p.updated_at granted_at
FROM badge_posts p
WHERE p.like_count >= 25 AND
(:backfill OR p.id IN (:post_ids) )

The clause (:backfill OR p.id IN (:post_ids) ) allows us to filter the results. When the daily job runs :backfill is true so the entire set is scanned. When the delta jobs run :backfill is false and :post_ids is set.

Why can't this be done "automatically"

Our badge grant query runs your badge query in a "subquery", I fount that often the postgres optimiser is tripping when and scanning the full set when the clause is on the main query. On trivial queries it may be smart enough, but once you start working with aggregates it just does not seem to catch.

To avoid any potential issues this constraint was added, it also allows you to apply the filters in the most correct spot.

What if all of this is just too complicated for me?

If you are having trouble writing a badge query, post a question on meta, describe what you are trying to solve and your work in progress. We will try to help.

Badge triggers is a complex subject often "daily" updates suffice and all this complex stuff can be skipped.

Posts: 3

Participants: 2

Read full topic

Emoticon regex is not looking at word breaks

[quote] with no params results in malformed quote blocks

$
0
0

Jeff Atwood wrote:

Notice quote is missing top padding! What it should look like:

Using Markdown blockquote

or

using HTML blockquote

[quote=""]This is a [ quote ] block[/quote]
[quote]
Here is another [ quote ] block
[/quote]

For additional fun: 4 space indented code blocks don't work on the above due to some vagaries of our parsing. But that's a different bug...

Posts: 4

Participants: 1

Read full topic

500 error on "Edit Badges"

$
0
0

Jakob Borg wrote:

In v1.0.0, going to any user's admin page and pressing "Edit Badges" results in this:

Started GET "/users/sockpuppet/badges_json.json?_=1409138601921" for 94.245.35.4 at 2014-08-27 11:40:55 +0000
Processing by UserBadgesController#username as JSON
  Parameters: {"_"=>"1409138601921", "username"=>"sockpuppet"}
Completed 500 Internal Server Error in 19ms

NoMethodError (undefined method `position' for nil:NilClass):
  app/serializers/basic_user_badge_serializer.rb:11:in `grouping_position'
  app/controllers/application_controller.rb:187:in `serialize_data'
  app/controllers/application_controller.rb:198:in `render_serialized'
  app/controllers/user_badges_controller.rb:29:in `username'
  lib/middleware/anonymous_cache.rb:119:in `call'
  config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
  config/initializers/silence_logger.rb:26:in `call'
  lib/middleware/unicorn_oobgc.rb:95:in `process_client'

Posts: 2

Participants: 1

Read full topic


Unable to upgrade properly?

$
0
0

PJH wrote:

Docker:

Admin:

Hash given in docker matches with the latest commit (at the time of posting) at github.

Posts: 8

Participants: 5

Read full topic

Increasing the font size

$
0
0

Daniel Hollands wrote:

I've switched the main font on my Discouse forum to that of PT Sans (which I love). The problem with it is, it appears to display slightly smaller than your default font, which has lead to some people asking for me to increase the font size on the forum.

I know this should be a simple CSS fix, but I've not quite been able to work out what selector (or selectors) to update to set a larger font size, without a lot of fuss.

What's the cleanest way of knocking the font size up a couple of pixels?

Cheers.

Posts: 4

Participants: 4

Read full topic

How does discourse generate its default avatars?

$
0
0

Joe Dallago wrote:

I'm looking into different options for generating unique avatars, and I'm curious as to how discourse generates the letter avatars.

Posts: 6

Participants: 4

Read full topic

Updating Font Awesome icons?

$
0
0

Michael Downey wrote:

Is there any plan or schedule to update the upstream Font Awesome version? There is an icon in version 4.2 that I'd like to use for a badge. smile

Posts: 1

Participants: 1

Read full topic

Custom html on home page

$
0
0

Martis Genus wrote:

Hey guys,
Thanks for creating such a great product. I really love discourse!
What I'm currently missing is an easy way to add custom HTML to the home page without writing a plugin. It would be great to have something like you did with "Content -> Top of the pages" and "Content -> Bottom of the pages" but for the home page ("Content -> Bottom of the home page").
I kind of see the problem of adding too many sections, but on the other site it's kind of important to be able to customize home. What do you think?

Posts: 3

Participants: 3

Read full topic

Viewing all 60613 articles
Browse latest View live




Latest Images