Deployment options?


#1

I know it is an old topic. But I still want to know whether there is a tutorial of deploying reaction to AWS, Azure or Heroku.

The tutorial of deploying to Heroku is sort of outdated and not working:
https://docs.reactioncommerce.com/reaction-docs/master/deploying-reaction-using-heroku

Thanks


#2

Docker is still the recommended deployment method and you can use it on just about any platform. You can either use Docker Machine or do a manual server setup to get the server ready. Then the same docker build/run commands would apply as when you run them locally. Also, the directions for deploying with Docker and Docker Machine are still valid.

Using Digital Ocean as an example (because it’s one of the simplest to use), the steps in the docs essentially boil down to this:

# start a server on Digital Ocean
# https://docs.docker.com/machine/drivers/digital-ocean/
docker-machine create \
  --driver digitalocean \
  --digitalocean-access-token <YOUR API KEY> \
  --digitalocean-size 1gb \
  reaction-host


# configure Docker to run commands on that server
eval "$(docker-machine env reaction-host)"


# Reaction
# https://github.com/reactioncommerce/reaction
docker run -d -p 80:3000 \
  -e ROOT_URL="http://yoursite.com" \
  reactioncommerce/reaction:latest

Note that since the example above didn’t define a MONGO_URL, the app will use a Mongo instance inside the Reaction container. That’s not recommended for production deployments, but it’s much quicker than dealing with an external database if you just want to get things up and running for testing.

Once you’re ready for production, you would point your app to an external database url like this:

docker run -d -p 80:3000 \
  -e ROOT_URL="http://yoursite.com" \
  -e MONGO_URL="mongodb://exampledb.com:27017/dbname" \
  reactioncommerce/reaction:latest

The only difference to deploy to a different provider like AWS would be the docker-machine command at the top. The equivalent command on AWS would look like:

# start a server on AWS
# https://docs.docker.com/machine/drivers/aws/

docker-machine create --driver amazonec2 \
  --amazonec2-access-key <YOUR ACCESS KEY> \
  --amazonec2-secret-key <YOUR SECRET KEY> \
  --amazonec2-instance-type t2.medium \
  reaction-host

Changing Site Domain Without DB Reset
#3

Thank you so much for the detailed explanation. I will give a shot and have it updated here.


#4

I used two methodos with good results:

  • Deploy to Heroku, with the modified buildpack
  • Deploy to DigitalOcean using mupx, but, I had to modify the script to include plugin loader.

Carlos.


#5

@carlos-olivera Mupx and the underlying Docker container it uses (meteord) are no longer maintained. While they may work for some people, I don’t recommend using any Meteor project written by Arunoda or Kadira unless you know how to maintain it yourself.

https://voice.kadira.io/its-time-thank-you-bye-meteor-115dd649a8#.2qyzlkb34


#6

@jeremy, Yes, I know that, I experimented just as a test, it is very easy to use, unfortunately is not maintained anymore :pensive:

I have to know more about docker, is my next step.

Carlos.


#7

I successfully deployed it to DigitalOcean. The process was really smooth. Thanks a lot!


#8

Would you like to share your buildpack for Heroku?
Thanks


#9

@derek this fork, works well with reactionc:


#10

No, it did not work. Here is my flow:

mkdir store
cd store
git clone https://github.com/reactioncommerce/reaction.git
cd reaction
heroku create
heroku apps:rename myteststore --app (current-name)
heroku addons:create mongolab --app myteststore
heroku config:set ROOT_URL=http://myteststore.herokuapp.com
heroku buildpacks:set https://github.com/swrdfish/meteor-buildpack-horse.git
git push heroku master

Here is part of the failed build log:

-----> Building Meteor app with ROOT_URL: http://myteststore.herokuapp.com/
cfs:gridfs: updating npm dependencies – mongodb, gridfs-stream…
-----> Moving built slug to /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app
-----> Installing npm production dependencies on built slug

fibers@1.0.15 install /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/node_modules/fibers
node build.js || nodejs build.js
linux-x64-46 exists; testing
Binary is fine; exiting
meteor-dev-bundle@0.0.0 install /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server
node npm-rebuild.js
fsevents@1.0.14 install /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/fsevents
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download: https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v46-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.0.14 and node@4.6.1 (node-v46 ABI) (falling back to source compile with node-gyp)
make: Entering directory /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/fsevents/build' SOLINK_MODULE(target) Release/obj.target/.node COPY Release/.node make: Leaving directory/tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/fsevents/build’
sauce-connect-launcher@0.13.0 postinstall /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/sauce-connect-launcher
node scripts/install.js
phantomjs-prebuilt@2.1.13 install /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt
node install.js
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving…
Received 22866K total.
Extracting tar contents (via spawned process)
Removing /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1482916031343/phantomjs-2.1.1-linux-x86_64 -> /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Phantom installation failed { [Error: EACCES: permission denied, open ‘/tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt/lib/location.js’]
errno: -13,
code: ‘EACCES’,
syscall: ‘open’,
path: ‘/tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt/lib/location.js’ } Error: EACCES: permission denied, open '/tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt/lib/location.js’
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.writeFileSync (fs.js:1156:15)
at writeLocationFile (/tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt/lib/util.js:84:6)
at Promise._successFn (/tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/phantomjs-prebuilt/install.js:88:5)
at nextTickCallback (/tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/node_modules/kew/kew.js:47:28)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
npm ERR! Linux 3.13.0-105-generic
npm ERR! argv “/app/tmp/cache/1.4.2/.meteor/packages/meteor-tool/.1.4.2.1r0536n++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node” “/app/tmp/cache/1.4.2/.meteor/packages/meteor-tool/.1.4.2.1r0536n++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm” “rebuild” "–update-binary"
npm ERR! node v4.6.1
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! phantomjs-prebuilt@2.1.13 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.13 install script ‘node install.js’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs phantomjs-prebuilt
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/momentjs_moment/npm-debug.log
npm WARN meteor-dev-bundle@0.0.0 No description
npm WARN meteor-dev-bundle@0.0.0 No repository field.
npm WARN meteor-dev-bundle@0.0.0 No license field.
npm ERR! Linux 3.13.0-105-generic
npm ERR! argv “/app/tmp/cache/1.4.2/.meteor/packages/meteor-tool/.1.4.2.1r0536n++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node” “/app/tmp/cache/1.4.2/.meteor/packages/meteor-tool/.1.4.2.1r0536n++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm” “install” "–production"
npm ERR! node v4.6.1
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! meteor-dev-bundle@0.0.0 install: node npm-rebuild.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle@0.0.0 install script ‘node npm-rebuild.js’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the meteor-dev-bundle package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node npm-rebuild.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs meteor-dev-bundle
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls meteor-dev-bundle
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/build_c7681fb2e02e78268bebbeb33712a377/.meteor/heroku_build/app/programs/server/npm-debug.log
! Push rejected, failed to compile Node.js app.
! Push failed


#11

Try to downgrade momentjs, I had problem with this package, I removed it, and installed an older version, then works.

Carlos.


#12

Hey, could you write a short guide about how you did it? I would really appreciate it!


#13

I was following instruction here:
https://docs.reactioncommerce.com/reaction-docs/master/deploying-reaction-using-docker

Let me know if you have any question.


#14

@derek @LukasNavickas Hello, here is one I have written and has been used successfully for about 3 months now by different teams :point_right: Reaction Commerce Heroku-Deploy Guide.

Kindly let me know if it was helpful and straightforward enough.