How do I deploy to meteor with a single command including username and password

Hello,

I am setting up automatic deployments through circle ci. I am not able to login manually and the need to login via the command line on each deployments. Is there a way to login via some setting or directly via the command line in one command? I tried this and it’s not working:


printf "${METEOR_USERNAME}\n${METEOR_PASSWORD}\n" | DEPLOY_HOSTNAME=us-east-1.galaxy-deploy.meteor.com meteor deploy --settings settings.json tfa.meteorapp.com

The username gets entered but it doesn’t seem to accept the password. Any help would be greatly appreciated.

Thanks!

This works perfectly for me

You login to meteor from your Dev box cli, then copy the contents of the json token to an env variable on your CI box

Here are a set of build commands that work on a CI server.

You will need to update the below to match the paths of where you store these files or ENV variables. I don’t think the ‘meteor npm i’ step is necessary, just fyi. We use SemaphoreCI.

curl https://install.meteor.com/ | /bin/sh
meteor --version
meteor npm i
export METEOR_SESSION_FILE=/home/custom_path/deployment_token.json
export DEPLOY_HOSTNAME=us-east-1.galaxy-deploy.meteor.com
meteor deploy  --settings /home/custom_path/meteor-settings-production.json  your-app-name.meteorapp.com

Thanks @sbr464! I was able to get it working with your advice. On circleci, I set the contents of the deployment json to an environment variable and create the file per build with an echo statement. Here’s my circle.yml file if it helps anyone else.

machine:
  node:
    version: 6.1.0
dependencies:
  cache_directories:
    - "~/.npm"
    - "~/.meteor"
    - "node_modules"
    - "./.meteor/local/build"
    - "./.meteor/local/bundler-cache"
    - "./.meteor/local/isopacks"
    - "./.meteor/local/plugin-cache"
    - "/home/ubuntu/nvm/versions/node/v6.1.0/bin"
    - "/home/ubuntu/nvm/versions/node/v6.1.0/lib/node_modules"
checkout:
  pre:
    - meteor || curl https://install.meteor.com/ | sh
  post:
    - git submodule update --init
    - meteor npm install
deployment:
  production:
    branch: "master"
    commands:
      - echo $DEPLOY_JSON > /home/ubuntu/deployment.json
      - meteor deploy --settings settings.json tfa.meteorapp.com

Got it working thanks!!!