[SOLVED] Mup problem with 1.4.2

#1

I’m not sure on what repo to post this, so I’m posting this here: (mup, not mupx)

When I’m trying to deploy to production with mup deploy I get the following error:

[x.com] - Uploading bundle
[x.com] - Uploading bundle: SUCCESS
[x.com] - Setting up Environment Variables
[x.com] - Setting up Environment Variables: SUCCESS
[x.com] - Invoking deployment process
[x.com] x Invoking deployment process: FAILED

	-----------------------------------STDERR-----------------------------------
	bash: line 46: [: ./Sorting: binary operator expected
	bash: line 50: [: ./Sorting: binary operator expected
	bash: line 54: [: ./Sorting: binary operator expected
	bash: line 18: cd: ./*: No such file or directory
	-----------------------------------STDOUT-----------------------------------
	----------------------------------------------------------------------------

Any ideas what I could do to debug this? I’m using this version of mup: https://github.com/mscherer82/meteor-up by @mscherer82) EDIT: I was wrong, I’m also using: https://github.com/M4v3R/meteor-up by @M4v3R

(source: https://github.com/M4v3R/meteor-up/blob/master/templates/linux/deploy.sh)

    isBinaryModule="no"
    # recursively rebuild npm modules inside node_modules
    check_for_binary_modules () {
      if [ -f binding.gyp ]; then
        isBinaryModule="yes"
      fi

      if [ $isBinaryModule != "yes" ]; then
        if [ -d ./node_modules ]; then
          cd ./node_modules
          for module in ./*; do   //<----------------------- this is 'line 18'
            cd $module
            check_for_binary_modules
            cd ..
          done
          cd ../
        fi
      fi
    }

Could this be related to https://github.com/meteor/meteor/issues/7974, reported by @glasser?

#2

Seems like a forked version of the old-old mup :slight_smile:

You might want to try switching to this version of mup: https://github.com/kadirahq/meteor-up

Also if you do, you’ll need to user the abernix/meteord:base docker image (easy switch in configuration file). The switch is pretty painless - only took us 20-30 minutes to do.

#3

thanks @typ, I’ll give that a try.

But am I really the only one still using mup-original?
(I’m doing some esoteric phantomjs pdf rendering, hence I did not yet switch to Galaxy)

#4

I’m having the same problem using another fork: https://github.com/M4v3R/meteor-up
My app is on digital ocean and I don’t know what I need to do to switch to mupx container-based version. Is there anything I need to configure on the server?
@typ any guide to follow?

#5

Done. Moved to mupx with abernix/meteord:base and it works except for a verify deployment failed:

[178.62.99.159] x Verifying deployment: FAILED
	
	-----------------------------------STDERR-----------------------------------
	 Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
	curl: (56) Recv failure: Connection reset by peer
	  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
	                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
	curl: (56) Recv failure: Connection reset by peer
	
	> fibers@1.0.15 install /bundle/bundle/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 /bundle/bundle/programs/server
	> node npm-rebuild.js
	
	
	> bcrypt@0.8.7 install /bundle/bundle/programs/server/npm/node_modules/bcrypt
	> node-gyp rebuild
	
	 
	=> Redeploying previous version of the app
	 
	-----------------------------------STDOUT-----------------------------------
	
	To see more logs type 'mup logs --tail=50'
	
	----------------------------------------------------------------------------

The application is running anyway

#6

( FYI : I just tried 1.4.2.1, the problem is still there…)

#7

The problem was occurring due to a node_modules folder only containing an invisible folder (./bin).

By adding an extra check, the problem was solved. (commit)

You can try this repo: https://github.com/Azumuta/meteor-up

I also created a pull request on @M4v3R’s repo: https://github.com/M4v3R/meteor-up/pull/1

1 Like
#8

@batist I’ve merged your commit to my repo.

2 Likes
#9

verify deployment failed: I may be wrong but my understanding is this error can be caused when it just takes too long to deploy. I’m suspecting that my “fixture.js” I run on first startup is taking too long to install default values in Mongo and that a timeout is occurring and resulting in that error. I got the same error but have not had any problems with the application. Everything seems to be working fine. I should probably redeploy without running the database updates to see if that results in the same error. I’m using mupx on Meteor 1.2.

#10

You just need to increase the deploy wait time to something higher. This happens to us as well.

#11

A few days ago I tried with 45 seconds but it was probably not enough. I’ll
try something higher. Thanks

#12

Honestly, we’re at 120 seconds as sometimes we have long running migrations.

#13

Thanks! Had the same issue that started this thread and with @batist’s merge into your repo, it was sorted out.

It’s a real pain these days to deploy a Meteor app – it’s like roulette.

1 Like
#14

I tried M4v3R fork, sadly without luck :frowning:

x Invoking deployment process: FAILED

    -----------------------------------STDERR-----------------------------------
    npm WARN package.json mongodb@1.4.35 No license field.
    npm WARN excluding symbolic link browser -> dist/browser
    npm WARN deprecated github-flavored-markdown@1.0.1: This project is long out of date. Use 'marked' instead.
    npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
    npm WARN deprecated node-uuid@1.4.7: use uuid module instead
    npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'
    npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
    npm WARN deprecated tap-assert@0.0.11: use the 'tap' module instead
    npm WARN deprecated tap-producer@0.0.1: This module is not supported. Please use 'tap' instead.
    npm WARN deprecated tap-results@0.0.2: This module is not supported. Please use 'tap' instead.
    bash: line 5: cd: ./*: No such file or directory
    -----------------------------------STDOUT-----------------------------------
    0.1)
    ├── tar@1.0.3 (inherits@2.0.3, block-stream@0.0.9, fstream@1.0.10)
    ├── cheerio@0.17.0 (entities@1.1.1, dom-serializer@0.0.1, lodash@2.4.2, CSSselect@0.4.1, htmlparser2@3.7.3)
    └── request@2.79.0 (aws-sign2@0.6.0, tunnel-agent@0.4.3, forever-agent@0.6.1, oauth-sign@0.8.2, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, aws4@1.5.0, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, uuid@3.0.0, qs@6.3.0, combined-stream@1.0.5, mime-types@2.1.13, tough-cookie@2.3.2, form-data@2.1.2, hawk@3.1.3, http-signature@1.1.1, har-validator@2.0.6)
    
    nodeunit@0.7.3 node_modules/nodeunit
    ├── tap-assert@0.0.11
    └── tap-producer@0.0.1 (inherits@2.0.3, yamlish@0.0.7, tap-results@0.0.2)
    
    integra@0.1.8 node_modules/integra
    ├── esprima@1.0.4
    ├── mkdirp@0.5.1 (minimist@0.0.8)
    ├── escodegen@1.1.0 (estraverse@1.5.1, esutils@1.0.0, source-map@0.1.43)
    └── handlebars@2.0.0-alpha.1 (optimist@0.3.7, uglify-js@2.3.6)
    
    markdown@0.3.1 node_modules/markdown
    
    bson@0.2.22 node_modules/bson
    └── nan@1.8.4
    ----------------------------------------------------------------------------
#15

@M4v3R, I’m using your mup fork and just had a requirement for SSL, are you using SSL with your fork? If so, are there instructions on how to get SSL working somewhere?

#16

@aadams I’m using Let’s Encrypt on my servers and it works fine with MUP. You need to proxy your app with Nginx though. Here’s a guide on how to do it: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-meteor-js-application-on-ubuntu-14-04-with-nginx

#17

Thanks @M4v3R. And are there let’s encrypt instructions too?

#18

To install Let’s Encrypt, you have to SSH to the server and issue (replace DOMAIN_NAME with your domain name):

sudo -i
mkdir -p /var/www
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
service nginx reload
cd /opt/letsencrypt
./letsencrypt-auto certonly -a webroot --webroot-path=/var/www -d DOMAIN_NAME

After that’s finished edit Nginx config to enable SSL and using the generated cert. Here’s what I’ve added to the server block:

ssl on;
ssl_certificate /etc/letsencrypt/live/DOMAIN_NAME/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/DOMAIN_NAME/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA;
ssl_session_cache shared:SSL:50m;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_prefer_server_ciphers on;

After this restart Nginx. Then it’s also good to setup automatic renewals. To do this edit Crontab with crontab -e command and write:

30 2 * * 1 /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log
35 2 * * 1 /etc/init.d/nginx reload

This will try to renew all your domains on this server every week at night.

1 Like
#19

Thanks again @M4v3R . I got nginx installed on a fresh server.

Now I need to create a virtual host configuration file in /etc/nginx/sites-available?

The example file looks like the following, does your file look close to this or similar, any tips to get this step right?

server_tokens off; # for security-by-obscurity: stop displaying nginx version

# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

# HTTP
server {
    listen 80 default_server; # if this is not a default server, remove "default_server"
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html; # root is irrelevant
    index index.html index.htm; # this is also irrelevant

    server_name todos.net; # the domain on which we want to host the application. Since we set "default_server" previously, nginx will answer all hosts anyway.

    # redirect non-SSL to SSL
    location / {
        rewrite     ^ https://$server_name$request_uri? permanent;
    }
}

# HTTPS server
server {
    listen 443 ssl spdy; # we enable SPDY here
    server_name todos.net; # this domain must match Common Name (CN) in the SSL certificate

    root html; # irrelevant
    index index.html; # irrelevant

    ssl_certificate /etc/nginx/ssl/todos.pem; # full path to SSL certificate and CA certificate concatenated together
    ssl_certificate_key /etc/nginx/ssl/todos.key; # full path to SSL key

    # performance enhancement for SSL
    ssl_stapling on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 5m;

    # safety enhancement to SSL: make sure we actually use a safe cipher
    ssl_prefer_server_ciphers on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK';

    # config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
    # to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
    add_header Strict-Transport-Security "max-age=31536000;";

    # If your application is not compatible with IE <= 10, this will redirect visitors to a page advising a browser update
    # This works because IE 11 does not present itself as MSIE anymore
    if ($http_user_agent ~ "MSIE" ) {
        return 303 https://browser-update.org/update.html;
    }

    # pass all requests to Meteor
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade; # allow websockets
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP

        # this setting allows the browser to cache the application in a way compatible with Meteor
        # on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 days)
        # the root path (/) MUST NOT be cached
        if ($uri != '/') {
            expires 30d;
        }
    }
}
#20

Yep, it’s pretty similar to mine (I don’t use the IE <= 10 redirection).

Note that in the proxy_pass line you define a port, in this case it’s 8080. You have to set the same port in your mup.json file in the env section, like this:

  "env": {
    "PORT": 8080,
    ...
1 Like