These are chat archives for reactioncommerce/reaction

4th
Apr 2016
saeed yaghuti
@SaeedYaghuti
Apr 04 2016 06:55
hi guy; I installed reaction and nginx on my server, reaction is running on localhost:3000,
sumbody can send me nginx.conf file for me, I try a lot but can't access app from inserting IP of my server on browser
Brent Hoover
@zenweasel
Apr 04 2016 08:03
Here is an nginx.conf that works for me. Obviously you will need to change some values:
worker_processes 2;
error_log /Users/brent/logs/nginx/nginx_error.log;

events {
  worker_connections 65536;
}

http {
  default_type  application/octet-stream;
  sendfile on;
  tcp_nopush  on;
  tcp_nodelay on;
  gzip off;
  access_log off;
  proxy_buffering off;

  upstream backend {
    server 127.0.0.1:3000 max_fails=5 fail_timeout=240s;
  }

  server {
    listen 80 default;
    listen 443 ssl default;

    server_name .dev.brenthoover.com;

    root /Users/brent/Projects/js/reaction;
    error_log /Users/brent/logs/nginx/nginx_error.log;

    location / {
      proxy_pass http://backend;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }
  }
}
saeed yaghuti
@SaeedYaghuti
Apr 04 2016 08:08
I will change server_name .dev.brenthoover.com; to server_name http://185.55.226.169;
Brent Hoover
@zenweasel
Apr 04 2016 08:09
Yes, you will also need to change the directories where things are located, e.g. logs etc.
xiaoc li
@brianxcli
Apr 04 2016 08:10
Hello, any clue of the load available for a single Reaction instance?
Brent Hoover
@zenweasel
Apr 04 2016 08:11
@brianxcli It would depend a lot on the hardware you are working on and your configuration
Also your db configuration, how many products you have, etc.
xiaoc li
@brianxcli
Apr 04 2016 08:16
Yes, you're right. I am building a website for a retail computer shop, is there any way I can test that?
I'm not sure whether I should use nginx or not
Brent Hoover
@zenweasel
Apr 04 2016 08:16
Do you know what level of traffic you are expecting?
If you want to do SSL (which I assume you do) then Nginx makes that a lot easier
xiaoc li
@brianxcli
Apr 04 2016 08:18
Oh, yes.
I will have a chat with the shop owner and confirm the traffic level.
Brent Hoover
@zenweasel
Apr 04 2016 08:19
I would tend to want to measure traffic in number of concurrent sessions
I think a single instance should handle most small shops
xiaoc li
@brianxcli
Apr 04 2016 08:22
The business is not big, the peak is possibly no more than a hundred ?
Brent Hoover
@zenweasel
Apr 04 2016 08:23
A hundred concurrent session is still a fair amount
Probably at least preparing to have more than one instance would be prudent
It relatively simple to bring up more instances if you lay out your deployment correctly
In this article she talks about having >500 concurrent users before having to scale up so…
https://medium.com/@eliezer/first-experiences-scaling-a-meteor-app-14a48e62a4af#.uf9r2eu97
xiaoc li
@brianxcli
Apr 04 2016 08:26
Thanks. I will look into it.
Brent Hoover
@zenweasel
Apr 04 2016 08:27
that article does a good job of describing scaling up on a budget
@SaeedYaghuti You may want to take a look at that article too as it has a lot of good links to articles on how to set up various parts of your infrastructure
xiaoc li
@brianxcli
Apr 04 2016 08:29
When I talked a hundred, I imagined the worst in worst case. But I don't think the business can grow to that extent in the near future. It's not a big city.
Brent Hoover
@zenweasel
Apr 04 2016 08:31
I think you should be ok, but of course you should test it on your configuration. And when I say concurrent users I am thinking people who are very actively using the site
xiaoc li
@brianxcli
Apr 04 2016 08:31
Yes, thanks.
Brent Hoover
@zenweasel
Apr 04 2016 08:32
I come from a high volume ecommerce background, so I tend to be cautious and always want extra capacity
xiaoc li
@brianxcli
Apr 04 2016 08:33
I'm still new in this area, but I try to think more.
Brent Hoover
@zenweasel
Apr 04 2016 08:34
As long as you are monitoring, you can always float with a small configuration and adjust as you go
Are you replacing an existing site?
xiaoc li
@brianxcli
Apr 04 2016 08:35
Yes, I am.
Brent Hoover
@zenweasel
Apr 04 2016 08:35
So you should be able to get some stats from there, even if it’s just http server logs
You know about Kadira already?
xiaoc li
@brianxcli
Apr 04 2016 08:36
You mean...
It's a name that I think I know
Brent Hoover
@zenweasel
Apr 04 2016 08:37
They create tons of great packages so probably from there. But their bread and butter is performance monitoring
It’s already built into Reaction, you just need to sign up
xiaoc li
@brianxcli
Apr 04 2016 08:38
Oh, it's good.
In terms of multiple Reaction instances, can you suggest a way? I am considering using docker.
Brent Hoover
@zenweasel
Apr 04 2016 08:43
Yep, docker is the way to go.
That’s how we do it
xiaoc li
@brianxcli
Apr 04 2016 08:44
Haha, lucky.
Brent Hoover
@zenweasel
Apr 04 2016 08:44
We have a pre-built container you can use
xiaoc li
@brianxcli
Apr 04 2016 08:45
Yes, I saw it. It reminded me of that.
Brent Hoover
@zenweasel
Apr 04 2016 08:46
Honestly it adds a little bit of complexity up front, but allows you a lot of flexibility down the road
depending on how much experience with Docker you have
But learning Docker is also a skill that will just get more and valuable
xiaoc li
@brianxcli
Apr 04 2016 08:47
Definitely
Brent Hoover
@zenweasel
Apr 04 2016 08:48
If you feel like scaling up is something you may need to do, at least setting up a separate instance/container for the DB is a great investment
xiaoc li
@brianxcli
Apr 04 2016 08:49
Docker Hub has a MongoDB image, I remember.
Brent Hoover
@zenweasel
Apr 04 2016 08:50
Yeah, that’s what we use.
but having the db be separate (rather than running on localhost) means you can just add new instances to a load balancer rather than having to do some reconfiguration involving downtime
xiaoc li
@brianxcli
Apr 04 2016 08:56
I will do it locally for development.