@tenzan wrote:
Where can I see a template?
I wonder why this how-to didn't mention about
multisite.yml
structure
Posts: 3
Participants: 2
@tenzan wrote:
Where can I see a template?
I wonder why this how-to didn't mention about
multisite.yml
structure
Posts: 3
Participants: 2
@sam wrote:
Our official Docker container ships with a custom NGINX config that logs very rich information that can be used to debug server performance issues.
To achieve rich diagnostics, Discourse add 2 additional headers to all requests in application_controller.rb
def set_current_user_for_logs if current_user Logster.add_to_env(request.env,"username",current_user.username) response.headers["X-Discourse-Username"] = current_user.username end response.headers["X-Discourse-Route"] = "#{controller_name}/#{action_name}" end
Furthermore we define a custom NGINX log format:
log_format log_discourse '[$time_local] $remote_addr "$request" "$http_user_agent" "$sent_http_x_discourse_route" $status $bytes_sent "$http_referer" $upstream_response_time $request_time "$sent_http_x_discourse_username"';
This means that we track: User Agent, Duration, Status, Rails Duration, Referer and more for every request.
Out of the box NGINX does not log the time it spends in the "upstream" proxy, this is added to our logs using
$upstream_response_time
Given this rich information I took a stab at creating a "reporting tool" that analyzes the logs and gives you some interesting reports, the tool is early in development, but already useful: https://github.com/discourse/discourse/blob/master/script/nginx_analyze.rb
To run it (you will need to be on a very recent install, you must rebuild to update NGINX config):
cd /var/discourse ./launcher enter app cd /var/www/discourse/script ruby nginx_analyze.rb
The report provides the following:
Overview of request counts for the duration of the log
Total Requests: 11105 ( MessageBus: 6757 )
We can see that we processed 11105 requests total, 6757 were consumed by message_bus. To learn more about message bus see this post or search meta
Top 30 IPs by server load
Which IPs are responsible for the largest amount of CPU time?
IP Address Duration ---------- -------- 100.43.90.12 16.71 10.66.0.21 7.45 10.66.0.22 7.31 ... etc ...
So in the above we can see that Yandex crawling is causing a fair amount of load. As well as a couple of private IP addresses.
Top 30 Users by Server Load
Username Duration -------- -------- [Anonymous] 120.26 codinghorror 2.78 sam 2.69
It looks like me and @codinghorror are responsible for a bit of load here
Top 30 routes by Server Load
Route Duration ----- -------- topics/show 59.24 user_avatars/show_letter 21.07 user_avatars/show 14.92 forums/status 14.77 list/latest 4.94 topics/timings 4.10 static/cdn_asset 3.46 list/category_latest 0.98 topics/feed 0.97
This information is particularly useful for quite a few reasons and can be used for diagnostics.
Routes at the top of the list are ones that have the most impact on global performance so it makes sense for us to focus on improving them (or cutting down calls to them) first.
Top 30 urls by server load
Url Duration --- -------- GET /srv/status HTTP/1.1 14.77 HEAD /t/what-do-user-trust-levels-do/4924 HTTP/1.1 5.34 POST /topics/timings HTTP/1.1 4.10 GET /t/what-do-user-trust-levels-do/4924 HTTP/1.1 2.68 GET / HTTP/1.1 2.16
This shows us which URL are responsible for the most amount of load on the server. Perhaps there is a topic that has performance issues? Perhaps there is a page that is visited too often by bots?
Top 30 not found urls (404)
Url Count --- ----- GET //discourse-meta.s3-us-west-1.amazonaws.com/original/3X/e/1/e1fc4c5714ea45bc473feea787021d39f7133d22.png HTTP/1.1 9 GET //discourse-meta.s3-us-west-1.amazonaws.com/original/3X/7/2/72d2687d1d00c52c546727efbbc6d726f6e153de.png HTTP/1.1 2 GET /node/add HTTP/1.1 1
We can use this report to find broken links, in some cases it may make sense to place a redirect in place to help recover the traffic.
Posts: 1
Participants: 1
@cr4zyc4nuk wrote:
Hi All,
I'm new here, and we are excited to be joining the discourse community!
We are trying to implement a landing page similar to the smartthings community (
http://community.smartthings.com/
) We are trying to create a landing page carousel that only shows on the landing page, the carousel works great. Just trying to figure out how smartthings made their's only appear on the main page and not in the category pages.Any help would be much appreciated! I can PM our sandbox info if you need it.
Scott
Posts: 4
Participants: 3
@RaceProUK wrote:
Take the following block of links.
[a](/t/1000/1)[a](/t/1000/2)[a](/t/1000/3)[a](/t/1000/4)[a](/t/1000/5)[a](/t/1000/6)[a](/t/1000/7)[a](/t/1000/8)[a](/t/1000/9)[a](/t/1000/10)[a](/t/1000/11)[a](/t/1000/12)[a](/t/1000/13)[a](/t/1000/14)[a](/t/1000/15)[a](/t/1000/16)[a](/t/1000/17)[a](/t/1000/18)[a](/t/1000/19)[a](/t/1000/20)
Middle-clicking each one opens the numbered post in t/1000, as expected.
Left-click should do the same, right? Er, no; instead, the1000
is treated as if it's the slug, and removed. The post number is then misinterpreted as thetopic
number.OK, there's no t/1000 here, but it's the URL treatment that's important.
Edit: Interesting… can't reproduce it here…
Update: OK, try this one:
[link](/t/1000/29066)
link << That one triggers the bug
Posts: 4
Participants: 3
@Pirat wrote:
I propose to make an extra charge for the service plug-ins
This will increase the speed of development of plug-ins from different peopleThe purpose of selling everything related to the modification of discourse
The more buyers, the greater will be the new modifications
how you like the idea?
Posts: 2
Participants: 2
@AstonJ wrote:
Continuing the discussion from The Official Discourse Tags Plugin: discourse-tagging
Wonder if anyone else agrees it would be handy to be able to track categories or tags and just be notified when a new topic is posted in one.
So for example on a dog breed forum you get a notification when a topic is posted about a certain breed of dog (the tag). Or on a gaming site you get notified when a topic is posted about a certain game (the tag) you might be following and interested in. People can then review the topic/thread and decide whether they want to watch or track it.
On Xenforo there is this - which I think works really well:
Posts: 8
Participants: 5
@downey wrote:
Does anyone have an idea for how to change the text of the + New Topic button in the upper right of a specific category description page?
Creating a category for Q&A using the Solved Button plugin, and would like to change it to: + New Question
Posts: 6
Participants: 4
@cweiske wrote:
When are the badges for referred clicks ("Nice Share", "Good Share", "Great Share") calculated by Discourse?
Instantly when the URLs are opened by the users, or is it a cron that runs every night?
Posts: 2
Participants: 2
@UndecidedAdmin wrote:
Hello, I would like to completely disable the "Body is invalid; try to be a little more descriptive" check.
I have tried setting "body min entropy" to 2, or even 0, and I still get this error message when I try and post a message containing something like "UNSUBSCRIBE" (the whole contents of the message.
Is it possible to do this?
Posts: 2
Participants: 2
@pl3bs wrote:
So multisite confuses you, and you got the memory to dish out?
This guide is a how-to for people who can't quite wrap their heads around multisite, but need to have... multiple sites! Easy peasy.
Assumptions
- you've got multiple subdomains pointed to your server IP
- you've got at least 1 gig for each site in combined memory and swap
- you have root access to install new apps
- you're already familiar with docker and basic standalone setup
- currently on ubuntu 14.04 64bit
Okay, with that out of the way, lets move forward.
You'll need to setup nginx as a reverse proxy so that you can have the multiple web apps running through the same http port externally (80 or 443), assuming this is http, this is how it'll work out..
Install nginx
apt-get install nginx
zoom to the correct directory and download this snippet into it, rename appropriately
cd /etc/nginx/sites-enabled wget https://gist.githubusercontent.com/trident523/ee1be110212b4a7a1291/raw/9415a7f2e9bfd84a1c8857e17686bd526d4e652f/discourse.conf mv discourse.conf anyname.conf cp anyname.conf anyother.conf nano anyname.conf anyother.conf
so you should see a file like this:
upstream discourse {
#fail_timeout is optional; I throw it in to see errors quickly
server 127.0.0.1:4578 fail_timeout=5;
}# configure the virtual host
server {
# replace with your domain name
server_name discourse.example.com;location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
# pass to the upstream discourse server mentioned above
proxy_pass http:// discourse;
}
}You need to change the bold. Starting at the top, the two copies need to be differentiated. You can use discourse1, and discourse2, or whatever else.
The port can be ascending, so 4578, and 4579 will work.
The servername is the same name as you will configure in the app.yml files. These are the same as you will create the a-record with the hosting company. we'll use discourse1.example.com and discourse2.example.com.
So then the end result would be this:
upstream discourse1 {
#fail_timeout is optional; I throw it in to see errors quickly
server 127.0.0.1:4578 fail_timeout=5;
}# configure the virtual host
server {
# replace with your domain name
server_name discourse1.example.com;location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
# pass to the upstream discourse server mentioned above
proxy_pass http://discourse1;
}
}upstream discourse2 {
#fail_timeout is optional; I throw it in to see errors quickly
server 127.0.0.1:4579 fail_timeout=5;
}# configure the virtual host
server {
# replace with your domain name
server_name discourse2.example.com;location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
# pass to the upstream discourse server mentioned above
proxy_pass http://discourse2;
}
}Now nginx is setup, awesome.
Do you already have an app.yml? If so, you just need to copy a second one and differentiate some things in the file, if not:
cd /var/discourse cp /samples/standalone.yml /containers/discourse1.yml cd containers cp discourse1.yml discourse2.yml nano discourse1.yml discourse2.yml
now we need to change some settings inside the containers
look for this part:
You see those ports? Change the outgoing http port to 4578 on the first container, and 2222 for ssh. The next container after you close this file make it one up, 4579, and 2223
If you recall there is section to fill in the basics, including hostname. This is where you match what you choose for the subdomains with your a-records, and the nginx config files earlier. We are using discourse1.example.com, and discourse2.example.com here.
The only other differentiation is the volumes section below the standard configs. Check it here:
you see where I added an additional folder layer after shared? That's all there is to it. You can make this the hostnames, or ports, I suggest hostnames.
After you have edited both yaml files, you can do the regular
cd .. ./launcher bootstrap discourse1 && ./launcher start discourse1 ./launcher bootstrap discourse2 && ./launcher start discourse2
The last step would be to start the nginx service
service nginx restart
if fail, check
nginx -t
and solve issue.
Now, that wasn't so painful, was it?
Posts: 1
Participants: 1
@scanferla wrote:
Hello everyone
TL;DR
I want to know how I can add a custom function to the topic listview
and call it from the topic listtemplate
.
I'm developing an up/down voting plugin (I know...) and I've already implemented an initial and static UI:
For now, I've added some
HTML
+CSS
to the topic-list-item.raw.hbsI've also successfully added and configured the ActiveRecord Reputation System gem. So I already can (programmatically) vote up/down on
Topics
.Now I just need to make the
up
anddown
buttons work (of course! ).
The issue is that I cannot add any
helpers
to the template. I think the reason is because it's a raw.hbs file. So I can't add the{{action}}
or the{{view}}
helpers.
And I don't even know if making one of them work would be the ideal approach.I'm aware of the
initialize
function usingreopen
in order to change aview
.
So I'm thinking in being able to call, from the template, a custom function that I'll add to the discourse/topic-list-itemview
.
Is that possible and the best approach? If so, how can I do that?
I need this current step to be built in a way where I can, as a next step, call/request (or read) the voting
score
and display/toggle aclass
if the current user has already voted on thetopic
(just like theheart
button does).Thank you very much for your attention!
Bonus question: How can I avoid having to
./launcher rebuild app
(and wait several minutes) every time I change something on myplugin
code?
Posts: 3
Participants: 2
@christine wrote:
Can one auto-generate a post, either through an existing plugin or through a ruby script or sql? If so what is the syntax? I'd love for people to get a PM when they get a badge for example.
Posts: 1
Participants: 1
@ankh2054 wrote:
Hi all,
Ive successfully imported my old phphbb3 forum, but have since noticed that users marked as inactive on the old phpbb site did not import (understandably) and all their posts were marked as system.
Is there a way to re-imprt just those users and attach back to their the posts?
thanks
Posts: 1
Participants: 1
@sam wrote:
About
The Discourse Solved plugin allows users to accept solutions on topics in designated categories.
Requirements
Discourse version
v1.4.0.beta2 +65
or laterInstallation
Repo is at: https://github.com/discourse/discourse-solved
In your
app.yml
add: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-solved.git
And then rebuild the container:
./launcher rebuild app
Configuration
Edit category you wish to enable accepted answers on:
As the OP (topic creator) you will have a button that allows you to accept an answer
Accepted answers are highlighted in the topic list:
Accepted answers are highlighted on the initial topic:
Original spec discussion
This is an official plugin, we plan to ship it to all our customers. Thank you to Western Digital for funding the development of this plugin!
Posts: 5
Participants: 5
@Simon_Cossar wrote:
Usercards are positioned off the screen for RTL layouts. This plugin fixes that.
Any suggestions for how to improve the code or the positioning of the usercard will be greatly appreciated.
Posts: 3
Participants: 2
@thisgeekza wrote:
NOTE: I solved my problem via rails console, however it would be MUCH easier if it was possible to do this in the interface.
I've got a user that has registered an account on my system, but they have typo'd their email address. I know this because I got a delivery failure message, and noticed the typo in the domain causing the problem. I thought it would be a simple matter to go in to the interface to edit the email address and re-send the activation email, however it seems that it is impossible to do so.
Searching meta led me in the direction of a convoluted method of either impersonating the user, or editing the email on their public profile. However, since the user has never logged in. the buttons to impersonate or view the public profile don't exist.
I don't think simply deleting the user and expecting them to figure out why they never received an email is the correct approach.
It is strange to me that as an admin, I can change the username and other settings of a user's profile from the admin page, but I can't do something as basic as editing their email address. - Perhaps there's some philosophy behind this choice that I'm missing.
Posts: 4
Participants: 3
@cyborg wrote:
I am planning to run a couple of Discourse forums with users and share the same user database.
Discourse A: 300 users
Discourse B: 100 users
Wordpress with OAuth server installed.Is there any way I could merge both 300+100 users into one database so all users can login everywhere?
Posts: 1
Participants: 1
@Tom_Newsom wrote:
It really is that easy! Thanks for making this so painless.
Posts: 1
Participants: 1
@clay wrote:
This seems like a regression this old bug...
Our company recently switched to Outlook 365 (the cloud-based one) and MobileIron mobile email client. However, this switch has led to the old bug rearing its head again: email replies are not stripping out old messages.
I'm happy to PM the raw email text that is causing the problem to somebody on the dev team - just let me know to whom I should send it.
Posts: 3
Participants: 2
@tobiaseigen wrote:
I got a complaint this morning that a user was getting repeat notifications overnight - it just started in the last 24 hours. I have been monitoring mandrill, and now see that it's the same 4 users who are getting lots of repeat emails from a bunch of topics that were contributed to in this time period. How can I troubleshoot this and stop it from happening?
Posts: 5
Participants: 3