These are chat archives for reactioncommerce/reaction

3rd
Sep 2017
Josh Cox
@joshuacox
Sep 03 2017 00:43
@tobitech there is an example plugin that is the result of going through that tutorial here with that specific file being this init.js
Sebastian Alvarado
@sebasalvarado
Sep 03 2017 16:18
Hey guys! I'm new to Reaction and I would like to know what config file or environment variable I would need to set in order to have a remote mongo db hosted database, I don't want my database to run in localhost
thansk!
Nile Frater
@NileFrater
Sep 03 2017 16:54
Thanks @loanlaux - Also ArtLimes is a pretty cool site regardless, cheers!
James Tann
@eltanno
Sep 03 2017 16:58

Hey guys, I am having some real trouble with performance. I am running on an DO Droplet, 4cpu 8GB instance with reaction running in docker + mongo in docker on the same machine). I have imported 10k products (its actually 1.5k products with variants.) But now reaction hangs on startup.

What can I do to improve performance? I am in need of a solution that can handle 100k products. Can you give me any guidance on what I could be doing wrong please? I have spent quite a lot of time on this already and dont want to see it wasted. Any help will be really welcome.

Thanks Jim.

James Tann
@eltanno
Sep 03 2017 17:15
Also, where can I find the log files inside of the docker container? I have ssh into the instance, but cant find where they are kept.
Jeremy Shimko
@jshimko
Sep 03 2017 17:56
You can (and should) set the MONGO_URL environment variable to configure an external database for production deployments.
There are no log files persisted inside the container. Reaction uses the Bunyan logging library and while it supports outputting to files, we only pipe to stdout by default. Out of the box you also have the option of configuring Loggly as an output source as well. See the logging docs for more info.
https://docs.reactioncommerce.com/reaction-docs/master/logging
Bunyan supports just about any output you can think of though, so there’s definitely an option for any workflow you need.
nguyen xuan tuan
@kappa2905_twitter
Sep 03 2017 18:04
install not run! unhopeless
I'm spend two day to process but unsuccess
Jeremy Shimko
@jshimko
Sep 03 2017 18:09
@eltanno I’m not against adding some additional configuration to allow persisting log files somewhere though. Some people may find that useful (although piping Docker container logs somewhere is already a pretty common workflow that has a lot more options).
Reaction generates a lot of logs though, so that would definitely require some additional cleanup jobs on the host OS or you’d end up with disk usage issues eventually. The log file storage path would also be different on every OS depending on whether you’re in development mode on Linux/Mac/Windows or in production in our default Docker image or something else altogether. So some planning would definitely have to happen there.
Anyway, Bunyan definitely supports it with a simple addition to the core logger config.
https://github.com/trentm/node-bunyan#stream-type-file
@kappa2905_twitter you will need to provide some info about your setup and the steps to reproduce your issue before anyone will be able to help you.
James Tann
@eltanno
Sep 03 2017 18:13

@jshimko great, thanks for the tips. Doyou have anything to say about the performance issues I’m experiencing? I dont want to sink lots of time to find that the inrfastructure needed for a 100k products install is jsut beyond my budget.

I tried having a seperate mongo db on another droplet, but the performance was terrible. So I went back to 1 server with containers for my app & mongo. Im sure I must be doing something very wrong, because it was absolutely unresponsive at only a few thousand products (including variants).

Thanks in advance,

Jeremy Shimko
@jshimko
Sep 03 2017 18:38
what size Digital Ocean servers were you using?
Jeremy Shimko
@jshimko
Sep 03 2017 18:46
Having mongo on another server definitely should not make it worse. It should be the other way around (assuming you’re not putting the servers on opposite sides of the country). So I suspect either something is misconfigured or you’re trying to use underpowered servers. On Digital Ocean, I recommend no less than the 2gb RAM, 2 vCPU box for the app server. And you’ll probably want at least the same for a Mongo server. And you definitely want a replica set in production (3 mongo servers).
Josh Cox
@joshuacox
Sep 03 2017 18:53
@jshimko he mentions DO Droplet, 4cpu 8GB instance, I certainly have noticed that both cloud and vps stuff can have terrible disk and network IO if their infrastructure is under any kind of load. And this goes for AWS, GCE, DO, linnode, you name it.
Does anyone know if reaction styles load scss actually does anything? I'm looking at style-loader.js
Jeremy Shimko
@jshimko
Sep 03 2017 19:06
it does not. reaction styles load works for css, less, scss, and stylus.
you don’t really ever need to run that manually though. it happens on every startup
the command only exists for automation
Jeremy Shimko
@jshimko
Sep 03 2017 19:16
The styles loader specifically looks for pluginName/client/index.{css,less,scss,styl} within each of the plugins in /imports/plugins/*
Also, if you’re using something other than css or less, you’ll have to make sure you install the proper Meteor package to compile your styles (fourseven:scss in your case)
so just add a client/index.scss in your plugin. next time you restart the app (not a reload, a full restart), the CLI should see the file and pull in your SCSS to be compiled by Meteor
Patrick Tavares
@patrick-tavares
Sep 03 2017 19:24
I'm trying to find a clean example of building a plugin using nothing by React components. I thought product-details-simple had been completely converted to React but it looks like there is still some Blaze wrapping going on... or am I misunderstanding the code?
at least for the layout it is since it's using coreLayout
James Tann
@eltanno
Sep 03 2017 20:01

@jshimko Yes, i am using a 4cpu 8GB droplet, so its above the spec that is suggested in the docs. It wont even start now that It has a few thousand products in it. This is really a proof of concept, I can chance the db setup later once I am convinced it works, but at the moment in just running into dead ends.

I will set up loggly, but do you have any idea why my performance would be so terrible? Anything at all?

Cheers

Josh Cox
@joshuacox
Sep 03 2017 20:34
@eltanno have you enabled the fast-render package in meteor? grep fast-render .meteor/packages
meteorhacks:fast-render # improve initial page loads
Jeremy Shimko
@jshimko
Sep 03 2017 20:35
I guess without knowing what you’re doing to import 100k products, I don’t have many suggestions off the top of my head. That should be enough resources. Is it possible that you’re running yourself out of disk space? If you had images with each of those 100k products, that’d certainly be plausible.
Josh Cox
@joshuacox
Sep 03 2017 20:37
I know there are people who frown at question like "why put images in the database", but it seems kind of silly to me to have static content in there, and becomes a bottleneck for sure, is someone working on an S3 compatible image solution?
Jeremy Shimko
@jshimko
Sep 03 2017 20:37
I mean any time a server comes to a halt and won’t run (or barely runs), that almost always means you’re out of something. It’s either CPU, RAM, or storage.
Yeah, images in the database definitely wasn’t ever proposed as the most performant solution. It’s being proposed as the only one that doesn’t require a non-free external service that you have to setup/configure just to be able to use Reaction. So yes, something like S3 is absolutely far more ideal for production, but it’s not simple or free and it’s not for everybody. We’re always happy to discuss plugin contributions if that’s something you’d like to tackle. It’s been on the to-do list for a long time.
Oluwatobi Omotayo
@tobitech
Sep 03 2017 20:49
@joshuacox I'm getting File Not Found error, even after restarting the project. I'm not sure I know where to add imports for the init.js file after creating it
Jeremy Shimko
@jshimko
Sep 03 2017 20:52
@joshuacox The main struggle with binary file storage is that as soon as you want to add a storage plugin, you now need a new storage API so that UI components can pull images from any supported storage backend without needing to care where it came from. As I’m sure you can imagine, that’s not a trivial amount of work in an app the size of Reaction. And it can’t just be “S3 or nothing” (as much as I’m personally fine with that). This stuff is absolutely a priority though. And I’m 100% on board with external storage, CDN’s, etc. But we still need to support Reaction working out of the box without external services. So we need a unified API that supports storage backend plugins.
Josh Cox
@joshuacox
Sep 03 2017 20:53
@tobitech did you clone the example plugin into imports/plugins/custom/ ?
Oluwatobi Omotayo
@tobitech
Sep 03 2017 20:54
no i just downloaded the zip
Josh Cox
@joshuacox
Sep 03 2017 20:56
@jshimko don't get me wrong, I feel where you guys are coming from, and I'm fine with people uploading into mongo, and then some backend process distributing out to CDN S3 etc, but can serve from mongo if the above fails (which is I think where the logical unification of which you speak, or at least the way I want it to end up)
@tobitech try forking the repo and cloning it directly into the above directory
or do people usually symlink repos into there?
Oluwatobi Omotayo
@tobitech
Sep 03 2017 20:57
alright let me try that
Josh Cox
@joshuacox
Sep 03 2017 20:58
it should be noted that everything in there is ignored by git cat imports/plugins/custom/.gitkeep
Oluwatobi Omotayo
@tobitech
Sep 03 2017 20:59
the .gitkeep seems to be empty???
Josh Cox
@joshuacox
Sep 03 2017 21:00
yep meaning nothing is kept, in respect to the reaction repo
repo's you place in there are not considered 'submodules' they are just standalone git repos, that's why I say just clone into there
Jeremy Shimko
@jshimko
Sep 03 2017 21:01
I think we removed the .gitkeep so that people can commit their custom plugins without git headaches. That may just not be in master yet
Reaction will never add anything there, so it’ll never be a potential merge conflict
Josh Cox
@joshuacox
Sep 03 2017 21:01
interesting to note, I kind of preferred it this way, but I'll prolly end up going the symlink route, if that doesn't bork the build process
Jeremy Shimko
@jshimko
Sep 03 2017 21:02
I’ve had success using git submodules there as well
although a lot of people hate those (I’m just not one of them)
git submodule add repoUrl ./imports/plugins/custom/myplugin
Josh Cox
@joshuacox
Sep 03 2017 21:04
I've seen them blow up in past (user error without a doubt) and people get jaded against it, but so long as you know about it, and re-read docs when in doubt they are not bad
Oluwatobi Omotayo
@tobitech
Sep 03 2017 21:05
should I discard the 'reaction-example-plugin' directory and work with the content alone... cos the clone added the content inside of that directory name?
Josh Cox
@joshuacox
Sep 03 2017 21:06
I have a few directories in imports/plugins/custom/ one my theme I'm tinkering on, and the example plugin too so I can poke around at everything there, I think each 'plugin' can have its own dir in there
so if you are in that dir, try git clone https://github.com/reactioncommerce/reaction-example-plugin.git mynewplugin
and then try a theme out git clone https://github.com/reactioncommerce/reaction-example-theme.git mynewtheme
or fork em first so you can save your changes to your fork
Oluwatobi Omotayo
@tobitech
Sep 03 2017 21:10
I just tried it with the 'reaction-example-plugin', it works. I can access an about page via localhost:3000/<shop-name>/about.
thanks
let me keep digging into the other customisations I want to make
Josh Cox
@joshuacox
Sep 03 2017 21:10
your welcome! don't forget to contribute back!
Oluwatobi Omotayo
@tobitech
Sep 03 2017 21:11
😀
Josh Cox
@joshuacox
Sep 03 2017 22:19
and gitkeep is only a placeholder, it being empty has no significance, it has no relation to gitignore