DigitalOcean ❤ Meteor 1.3

Let’s dive into the ocean!

Install Meteor 1.3 beta 5 on Ubuntu 14.04.3 x64 via DigitalOcean with MupX

A lot of change and deprecation for Meteor 1.3 and also mup, As we did deploy with mup before. So it’s about time to revisit! Good news is I didn’t have any real production with Meteor yet. So I still happy with it. ;)

Server side

We’ll use new DigitalOcean droplet like we already did here. Let’s ssh in.

$ ssh root@xxx.xxx.xxx.xxx

Oops! For some reason locale seem to not set properly. Let’s fix it!

WARNING! Your environment specifies an invalid locale.
This can affect your user experience significantly, including the
ability to manage packages. You may install the locales by running:
sudo apt-get install language-pack-UTF-8
or
sudo locale-gen UTF-8
To see all available language packs, run:
apt-cache search "^language-pack-[a-z][a-z]$"
To disable this message for all users, run:
sudo touch /var/lib/cloud/instance/locale-check.skip
Hint : Suggestion above didn’t work for me so don’t bother.

# Check locale

root@foo:~# locale

You should see what missing there.

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

# Fix locale

root@foo:~# export LANGUAGE="en_US.UTF-8"
root@foo:~# echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
root@foo:~# echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale
root@foo:~# exit

# Recheck locale

root@foo:~# locale

Now you should see

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

Great! no more warning, Let’s back to our local side.

root@foo:~# exit

Local Side

Server is ready let’s setup our local

# Install Meteor

$ curl https://install.meteor.com/ | sh

# Update to Meteor 1.3 beta 5

Present version is Meteor 1.2, We need update!

$ meteor update — release 1.3-modules-beta.5

# Get mupx

last time we use mup, now we’ll use mupx

$ sudo npm install -g mupx

# Grab some examples

yeah our beloved todos examples

$ meteor create — example todos

# Initialize mupx

$ mupx init

and you will get…

Meteor Up: Production Quality Meteor Deployments
 — — — — — — — — — — — — — — — — — — — — — — — — 
Configuration file : mup.json
Settings file : settings.json
Empty Project Initialized!
mup.json : Meteor Up configuration file
settings.json : Settings for Meteor’s settings API

# Config mup.json

Let’s open mup.json like a boss!

$ open -a TextEdit mup.json

Same as we did before, Just fill your host, username, password, app, ROOT_URL

{
// Server authentication info
"servers": [
{
"host": "123.456.78.90",
"username": "root",
"password": "password",
// or pem file (ssh based authentication)
// WARNING: Keys protected by a passphrase are not supported
//"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,
  // Application name (no spaces).
"appName": "todos",
  // 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": ".",
  // Configure environment
// ROOT_URL must be set to your correct domain (https or http)
"env": {
"PORT": 80,
"ROOT_URL": "http://123.456.78.90"
},
  // 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,
  // show a progress bar while uploading. 
// Make it false when you deploy using a CI box.
"enableUploadProgressBar": true
}

# Setting Up a Server

$ mupx setup

Go get some coffee and get back then you should see…

Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
Configuration file : mup.json
Settings file : settings.json
“ Checkout Kadira!
It's the best way to monitor performance of your app.
Visit: https://kadira.io/mup
Started TaskList: Setup (linux)
[123.456.78.90] - Installing Docker
[123.456.78.90] - Installing Docker: SUCCESS
[123.456.78.90] - Setting up Environment
[123.456.78.90] - Setting up Environment: SUCCESS
[123.456.78.90] - Copying MongoDB configuration
[123.456.78.90] - Copying MongoDB configuration: SUCCESS
[123.456.78.90] - Installing MongoDB
[123.456.78.90] - Installing MongoDB: SUCCESS

# Deploying an App

$ mupx deploy

Take a nap and when you wake up you should see…Error!

Meteor Up: Production Quality Meteor Deployments
 — — — — — — — — — — — — — — — — — — — — — — — — 
Configuration file : mup.json
Settings file : settings.json
“ Checkout Kadira!
It’s the best way to monitor performance of your app.
Visit: https://kadira.io/mup
Meteor app path : /Users/katopz/todos
Using buildOptions : {}
=> Errors executing Cordova commands:
While building Cordova app for platform Android:
Error:
/Users/katopz/todos/.meteor/local/cordova-build/platforms/android/cordova/build:
Command failed with exit code 2 Error output:
[Error: Failed to find ‘ANDROID_HOME’ environment variable. Try setting
setting it manually.
Failed to find ‘android’ command in your ‘PATH’. Try update your ‘PATH’ to
include path to valid SDK directory.]
at ChildProcess.whenDone
(/Users/katopz/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Socket.<anonymous> (child_process.js:979:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
=> Build Error. Check the logs printed above.

Something gone wrong there and here’s the clues. Let’s try!

# Remove unused platform

Both ios and android are not use here so...

$ meteor remove-platform ios android

And deploy again

Meteor Up: Production Quality Meteor Deployments
— — — — — — — — — — — — — — — — — — — — — — — —
Configuration file : mup.json
Settings file : settings.json
“ Checkout Kadira!
It’s the best way to monitor performance of your app.
Visit: https://kadira.io/mup
Meteor app path : /Users/katopz/todos
Using buildOptions : {}
Started TaskList: Deploy app ‘todos’ (linux)
[123.456.78.90] — Uploading bundle
[123.456.78.90] — Uploading bundle: SUCCESS
[123.456.78.90] — Sending environment variables
[123.456.78.90] — Sending environment variables: SUCCESS
[123.456.78.90] — Initializing start script
[123.456.78.90] — Initializing start script: SUCCESS
[123.456.78.90] — Invoking deployment process
[123.456.78.90] — Invoking deployment process: SUCCESS
[123.456.78.90] — Verifying deployment
[123.456.78.90] — Verifying deployment: SUCCESS

That’s it! After 1 Warning and 1 Error everything seem to working like expected. Hungry for more? try access MongoDB or try crash it!

Happy new year coding! :)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.