Deploying a meteor app using mongoLab and Heroku sandbox - mongodb

I've checked a couple of blogs. Specially this one about deploying and hosting meteor on heroku using mongolab.
I follow the steps below:
Create a meteor app (just for test v.1.4) meteor create test
cd test
git init
git add .
git commit -m "tst"
heroku create pikachu
heroku config:set ROOT_URL="https://pikachu.herokuapp.com"
heroku config:set MONGO_URL="pikachu:este#dsxxx.mlab.com:xxx/pikachueste"
heroku buildpacks:set https://github.com/Pushplaybang/meteor-buildpack-horse
git push heroku master
After deployment the following error appears:
Starting process with command .meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js
Process exited with status 8
assert.js:93
throw new assert.AssertionError: "undefined" === "function"
at wrapPathFunction(/app/.meteor/heroku_build/app/programs/server/mini- files.js:77:10)
at Object.<anonymus>(/app/.meteor/heroku_build/app/programs/server/mini-files.js:108:24)
...
Process exited with status 8
State changed from starting to crashed
I've notice that when I try to install mongodb addon in my sandbox:
heroku addons:create mongolab:sandbox
The process finish with:
!Please verify your account to install this add-on plan ...
Does the problem occur because I cannot install mongodb addon?
Is it possible to install mongodb addon in a heroku sandbox?
Is there any other alternative?
Thanks,

one of the reasons for this error:
assert.js:93
throw new assert.AssertionError: "undefined" === "function"
at wrapPathFunction(/app/.meteor/heroku_build/app/programs/server/mini- files.js:77:10)
at Object.<anonymus>(/app/.meteor/heroku_build/app/programs/server/mini-files.js:108:24)
Is that the node version being run on heroku is different from the one meteor is using. So far, Meteor is using node v.4.5.0 and the one your buildpack is using is below that. I've used that buildpack once and had the same error.
You can use the original meteor buildpack horse and deal with the
Please verify your account to install this add-on plan ... by removing the mongolab addon. I experienced these issues myself. You can refer to this guide so it can be much clearer to you. It uses a fork of the original meteor buildpack horse without the mongolab addon. Just follow the guide and you'll be fine.

Related

How to execute heroku cli cmd to reset postgresql addon as part of deployment's release phase

I was wondering if it is possible to run heroku cli command for resetting postgresql addon db as part of deployment Release phase. I have a node js graphql server application. All I want is that once its deployed, then run a heroku cli command to reset the database before running my migration scripts. I have the following Procfile
web: npm start
release: heroku restart && heroku pg:reset DATABASE --confirm <HEROKU_APP_NAME> && npx prisma migrate deploy
However I get the following error:
/bin/sh: 1: heroku: not found

How to connect local or external mongoDB instead of meteor's internal in Rocket.chat

Rocket.Chat Version: 0.56.0-develop
Running Instances: 1
DB Replicaset OpLog: Enabled
Node Version: v4.8.1
I cloned the git code and started rocket chat in my local machine Windods 7 by following instructions as bellow.
git clone https://github.com/RocketChat/Rocket.Chat.git
cd Rocket.Chat
meteor npm start
Now, I want during development my app to use my local mongoDB installation instead of meteors's internal. I tried a lot but did not get any help or clue. It seems I am missing somewhere. I attaching the screen of what I changed, I hope I am doing the right. I did changed in docker-compose.yml.

`Heroku pg:backups capture` gives "Resource not found" error

When running this command - either locally or through Codeship.io - I get an error message saying "Resource not found"
$ heroku pg:backups capture
! Resource not found
The problem started 2 days ago and thus my first guess was that it's because of the transfer from the old to the new PGBackups on Heroku (mapping guide).
This is not the case, the command syntax is already in the new format.
For reference my local toolbelt version:
$ heroku version
heroku-toolbelt/3.33.0 (x86_64-darwin10.8.0) ruby/1.9.3
You have no installed plugins.
Try to specify your database. For example, if you use ROSE:
heroku pg:backups capture HEROKU_POSTGRESQL_ROSE

How to deploy a meteor application to my own server?

How to deploy a meteor application to my own server?
flavour 1: the development and deployment server are the same;
flavour 2: the development server is one (maybe my localhost) and the deployment server is another (maybe a VPS in the cloud);
flavour 3: I want to make a "meteor hosting" domain, just like "meteor.com". Is it possible? How?
Update:
I'm running Ubuntu and I don't want to "demeteorize" the application. Thank you.
Meteor documentation currently says:
"[...] you need to provide Node.js 0.8 and a MongoDB server. You can
then run the application by invoking node, specifying the HTTP port
for the application to listen on, and the MongoDB endpoint."
So, among the several ways to install Node.js, I got it up and running following the best advice I found, which is basically unpacking the latest version available directly in the official Node.JS website, already compiled for Linux (64 bits, in my case):
# Does NOT need to be root user:
# create directory
mkdir -p ~/.nodes && cd ~/.nodes
# download latest Node.js distribution
curl -O http://nodejs.org/dist/v0.10.13/node-v0.10.13-linux-x64.tar.gz
# unpack it
tar -xzf node-v0.10.13-linux-x64.tar.gz
# discard it
rm node-v0.10.13-linux-x64.tar.gz
# rename unpacked folder
mv node-v0.10.13-linux-x64 0.10.13
# create symlink
ln -s 0.10.13 current
# add path to PATH
export PATH="~/.nodes/current/bin:$PATH"
# check
node --version
npm --version
And to install MongoDB, I simply followed the instructions in the MongoDB manual available in the Documentation section of its official website:
# Needs to be root user (apply "sudo" if not at root shell)
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/10gen.list
apt-get update
apt-get install mongodb-10gen
The server is ready to run Meteor applications! For deployment, the main "issue" is where the "bundle" operation happens. We need to run meteor bundle command from inside the application source files tree. For example:
cd ~/leaderboard
meteor bundle leaderboard.tar.gz
If the deployment will happen in another server (flavour 2), we need to upload the bundle tar.gz file to it, using sftp, ftp, or any other file transfer method. Once the file is there, we follow both Meteor documentation and the README file which is magically included in the root of the bundle tree:
# unpack the bundle
tar -xvzf leaderboard.tar.gz
# discard tar.gz file
rm leaderboard.tar.gz
# rebuild native packages
pushd bundle/programs/server/node_modules
rm -r fibers
npm install fibers#1.0.1
popd
# setup environment variables
export MONGO_URL='mongodb://localhost'
export ROOT_URL='http://example.com'
export PORT=3000
# start the server
node main.js
If the deployment will be in the same server (flavour 1), the bundle tar.gz file is already there, and we don't need to recompile the native packages. (Just jump the corresponding section above.)
Cool! With these steps, I've got the "Leaderboard" example deployed to my custom server, not "meteor.com"... (only to learn and value their services!)
I still have to make it run on port 80 (I plan to use NginX for this), persist environment variables, start Node.JS dettached from terminal, et cetera... I am aware this setup in a "barely naked" one... just the base, the first step, basic foundation stones.
The application has been "manually" deployed, without taking advantage of all meteor deploy command magic features... I've seen people published their "meteor.sh" and "meteoric.sh" and I am following the same path... create a script to emulate the "single command deploy" feature... aware that in the near future all this stuff will be part of the pioneer Meteor explorers only, as it will grow into a whole Galaxy! and most of these issues will be an archaic thing of the past.
Anyway, I am very happy to see how fast the deployed application runs in the cheapest VPS ever, with a surprisingly low latency and almost instant simultaneous updates in several distinct browsers. Fantastic!
Thank you!!!
Try Meteor Up too
With that you can deploy into any Ubuntu server. This uses meteor build command internally. And used by many for deploying production apps.
I created Meteor Up to allow developers to deploy production quality Meteor apps until Galaxy comes.
I would recommend flavor two with a separate deployment server. Separation of concerns leads to a more stable environment for your code and its easier to debug.
To do it, there's the excellent Meteoric bash script that helps you deploy to Amazon's EC2 or your own server.
As for how to roll your own meteor.com, I suggest you break that out into it's own StackOverflow question as it's not related. Plus, I can't answer it :)
I done with it few days ago. I deployed my Meteor application to my own server on the DigitalOcean. I used Meteor Up tool for managing deploys and Nginx on the server to serve the app.
It's very simple to use. You should install meteor up with the command:
npm install -g mup
Then create the folder for deployment configuration and go to the created directory. Then run mup init command. It will created two configuration files. We are have interest for mup.json file. It have configurations for deployment process. It's looks like this:
{
// Server authentication info
"servers": [
{
"host": "hostname",
"username": "root",
"password": "password",
// or pem file (ssh based authentication)
//"pem": "~/.ssh/id_rsa",
// Also, for non-standard ssh port use this
//"sshOptions": { "port" : 49154 },
// server specific environment variables
"env": {}
}
],
// Install MongoDB on the server. Does not destroy the local MongoDB on future setups
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: nodeVersion defaults to 0.10.36 if omitted. Do not use v, just the version number.
"nodeVersion": "0.10.36",
// Install PhantomJS on the server
"setupPhantom": true,
// Show a progress bar during the upload of the bundle to the server.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": true,
// Application name (no spaces).
"appName": "meteor",
// Location of app (local directory). This can reference '~' as the users home directory.
// i.e., "app": "~/Meteor/my-app",
// This is the same as the line below.
"app": "/Users/arunoda/Meteor/my-app",
// Configure environment
// ROOT_URL must be set to https://YOURDOMAIN.com when using the spiderable package & force SSL
// your NGINX proxy or Cloudflare. When using just Meteor on SSL without spiderable this is not necessary
"env": {
"PORT": 80,
"ROOT_URL": "http://myapp.com",
"MONGO_URL": "mongodb://arunoda:fd8dsjsfh7#hanso.mongohq.com:10023/MyApp",
"MAIL_URL": "smtp://postmaster%40myapp.mailgun.org:adj87sjhd7s#smtp.mailgun.org:587/"
},
// Meteor Up checks if the app comes online just after the deployment.
// Before mup checks that, it will wait for the number of seconds configured below.
"deployCheckWaitTime": 15
}
After you fill all data fields you can start the setup process with command mup setup. It will setup your server.
After sucessfull setup you can deploy your app. Just type mup deploy in the console.
Another alternative is to just develop on your own server to start with.
I just created a Digital Ocean box and then connected my Cloud9 IDE account.
Now, I can develop right on the machine in a Cloud IDE and deployment is easy--just copying files.
I created a tutorial that shows exactly how my set up works.
I had a lot of trouble with meteor up, so I decided writing my own deploy script. I also added additional info how to set up nginx or mongodb. Hope it helps!
See /sh folder in repository
What the script meteor-deploy.sh does:
Select environment (./meteor-deploy.sh for staging, ./meteor-deploy.sh prod for production)
Build and bundle production version of the meteor app
Copy bundle to server
SSH into server
Do a mongodump to backup database
Stop the running app
Unpack bundle
Overwrite app files
Re-install app node package dependencies
Start the app (uses forever)
Tested for the following server configurations:
Ubuntu 14.04.4 LTS
meteor --version 1.3.2.4
node --version v0.10.41
npm --version 3.10.3

How to remove postgres database from heroku

How to remove postgres database from heroku, which was created using the dev free plan.
https://postgres.heroku.com/databases
I tried using heroku addons:remove --confirm --app salty-river-24
but it says app not found. Is this the correct syntax.
First, check all the addons you have by running:
$ heroku addons
This lists all available addons (detailing name, plan, price and state). Here, note the detail provided next to the addon. For instance, you may see something like:
heroku-postgresql (postgresql-cubic-88094) hobby-dev free created └─ as DATABASE
To delete this specific addon, run:
$ heroku addons:destroy postgresql-asymmetrical-03894
postgresql-cubic-88094 is in brackets in the listed addon.
You will be asked to type in the name of your app or re-run the command using --confirm <name-of-your-app>. Do so and the addon will be deleted.
Confirm the addon is deleted by running:
$ heroku addons
If you created the database with the web UI on postgres.heroku.com, you need to navigate to it from https://postgres.heroku.com/databases , then click on the gear icon on the right. There should be a destroy link. If you don't see a destroy link, then you probably aren't the owner and lack privileges.
It looks like you're missing the name of the add-on. Example:
$ heroku addons:remove heroku-postgresql:dev --app salty-river-24
Use heroku addons --help to view the help, or heroku addons to list the add-ons for your app.