User Accounts broken on production build

I am trying to put my app into production, so far everything is working ok from using this guide https://www.digitalocean.com/community/tutorials/how-to-deploy-a-meteor-js-application-on-ubuntu-14-04-with-nginx

My upstart config is as follows:

# upstart service file at /etc/init/trusu.conf


# When to start the service
start on started mongodb and runlevel [2345]

# When to stop the service
stop on shutdown

# Automatically restart process if crashed
respawn
respawn limit 10 5

# we don't use buil-in log because we use a script below
# console log

# drop root proviliges and switch to mymetorapp user
setuid trusuprod
setgid trusuprod

script
    export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
    # set to home directory of the user Meteor will be running as
    export PWD=/home/trusuprod
    export HOME=/home/trusuprod
    # leave as 127.0.0.1 for security
    export BIND_IP=127.0.0.1
    # the port nginx is proxying requests to
    export PORT=8080
    # this allows Meteor to figure out correct IP address of visitors
    export HTTP_FORWARDED_COUNT=1
    # MongoDB connection string using trusu as database name
    export MONGO_URL=mongodb://localhost:27017/trusu
    # The domain name as configured previously as server_name in nginx
    export ROOT_URL=https://production.trusu.co
    # optional JSON config - the contents of file specified by passing "--settings" parameter to meteor command in development mode
    #export METEOR_SETTINGS='{ "somesetting": "someval", "public": { "othersetting": "anothervalue" } }'
    # this is optional: http://docs.meteor.com/#email
    # commented out will default to no email being sent
    # you must register with MailGun to have a username and password there
    export MAIL_URL=smtp://user:pass@smtp.sendgrid.net:587
    # alternatively install "apt-get install default-mta" and uncomment:
    # export MAIL_URL=smtp://localhost
    exec node /home/trusuprod/bundle/main.js >> /home/trusuprod/trusu.log
end script

But when I come to actually login to the app (my app is using the user accounts module) the app just submits the form and is unresponsive. Please try it here https://production.trusu.co

I notice in the web developer console the XHR for https://production.trusu.co/sockjs/info?cb=3nbhekisld and similar requests is failing occasionally.

Why is this? and more importantly how can it be fixed? I see no errors in the logs and sometimes the nginx server times out and I have to restart the meteor upstart.

Any advice is greatly appreciated

Hi @tomtom87

I don’t do it like that. Instead I use mupx, which has been pretty reliable.

It’s not 100% awesome, but I’ve tried a variety of other tools, and this one get’s me the furthest. I’d recommend it if you’re having trouble deploying.

One important thing is to wrangle the ports in your meteor apps. Meteor is http by default, so to get httpS, you need to put an proxy (nginx) in the front with your ssl cert.

Thanks for the reply @michaelcole

I’ve tried mupx on AWS and it was not working, but I will give it another go. Sorry for not being more clear I do infact have a nginx infront and wrangle the ports, I am using the proxy method and forwarding everything to SSL.

I will report back when I have tried mupx again and see what I can find.

Does any one know that bcrypt and cordova builds seem to be broken in the latest version of node / meteor? I have seen several people asking for help in posts but I was the only to reply.
The bcrypt is causing a issue when using the standard npm install inside the generated build from meteor build . and also if the android gradle cordova build is included in meteor 1.3 there is a java error which I cannot figure to resolve so had to disable android for now.

Are these known issues on some other board or something - I did not see anyone talk about how to fix it yet just posts asking for help

Edit: I Found the issue with bcrypt on the github now https://github.com/meteor/meteor/issues/7095

Thanks

This is purely my opinion, but building apps I find DigitalOcean a much better experience than AWS. I think AWS is the right tool for any app with > 20 instances. Before that, DO has been better for me. Also, mupx worked OOTB.

Totally agree about Digital Ocean over AWS (I actually have a DO setup and
it worked first time flawless) just my client has some fixation on AWS and
thinks its the dogs bollocks I cannot get him to change his mind. So i have
to find a way to get the AWS setup to work. Which is taking weeks so far.

LOL, other people’s money :slight_smile:

Mupx has a docker container if that helps at all: https://github.com/meteorhacks/meteord

1 Like

@michaelcole thanks alot mate!! Will try this out, just out of question by the way how much storage space does docker take for you? I have a ruby deployment and its like 3gb for everything an then meteor was taking in excess of 8gb (my device ran out of space) is this normal, I didn’t realise it will take quiet so much space you see.

Thanks man

@michaelcole just my luck - mupx seems to be broken currently… any ideas? https://github.com/arunoda/meteor-up/issues/1028

I use mupx for deploys on DigitalOcean’s Ubuntu 14.04_64 without problems.

This shouldn’t be a problem: npm -g install npm@latest unless node installed wrong.

Maybe your app is really broken? Have you tried deploying the todo app? What happens?

Re: disk space, I don’t really worry about it, now-a-days disk/mem/cpu is so cheap it’s more cost effective to just get more.

I fixed it yesterday by starting from scratch with mupx

Did anyone ever solve the problem with login/register not working? I’m having the same problem (I followed the same guide from DO). If I open an SSH tunnel to DO and browse directly to my Meteor app, everything works fine. But going through NginX the login/register just hangs. I can’t find anything in any of the logs that would indicate a problem. My suspicion is that it is a problem with WebSockets not working correctly. The appropriate part of my NginX config file:

        proxy_pass http://127.0.0.1:8080/;
        proxy_redirect off;

        proxy_set_header   Host              $host;
        proxy_http_version 1.1;
        proxy_set_header   X-Real_IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for; # preserve client IP
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   X-NginX-Proxy     true;
        proxy_set_header   Upgrade           $http_upgrade; # allow websockets
        proxy_set_header   Connection        "upgrade";

Anyone? Bueller?