Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use PRO on CI machine #421

Closed
cloudkite opened this issue Nov 18, 2017 · 14 comments
Closed

How to use PRO on CI machine #421

cloudkite opened this issue Nov 18, 2017 · 14 comments

Comments

@cloudkite
Copy link

cloudkite commented Nov 18, 2017

I have been using UP in production for a while now and just purchased the PRO ❤️

I'm currently using the community version with simple variable substitution to automatically deploy from CI.

How do I login and install the PRO version from a CI build machine so I can start using the new encrypted ENV features?

Thanks!

@tj
Copy link
Member

tj commented Nov 18, 2017

thanks for subscribing :D make sure to watch #415, should have it ready today

@tj tj closed this as completed Nov 18, 2017
@cloudkite
Copy link
Author

Awesome thanks 👍

@tj
Copy link
Member

tj commented Nov 18, 2017

I still have to document and simplify this, but for a Node app you'd do:

npm install -g yarn
yarn
sudo chown -R $(whoami) /usr/local/bin
curl -sfL https://raw.githubusercontent.com/apex/up/master/install.sh | sh
up upgrade
up deploy production

For env vars in Semaphore/Circle/Travis etc you'll need:

  • AWS_SECRET_ACCESS_KEY
  • AWS_ACCESS_KEY_ID
  • UP_CONFIG

Where UP_CONFIG is your ~/.up/config.json file (as a single line so it can be stored in an env var).

I'll add some command like up config copy to grab copy that to your clipboard easier

@cloudkite
Copy link
Author

@tj thanks already doing something very similar to this.

I was more thinking if I add an env through up on my local pro version. ie:
up env add DB_URL stage.mydb.hosted.com

Will the CI built deployment be able to read that env since it is not logged into my PRO up account?

@tj
Copy link
Member

tj commented Nov 19, 2017

ohhh I see what you mean, currently that won't work. You have to upgrade in CI as well, because the binary running on Lambda is baked into the Up binary, so you would end up running the version of Up which does not load the env vars at all.

I'll make sure to document that, it's definitely not clear.

@cloudkite
Copy link
Author

@tj the CI I'm using runs off docker images. Not really sure how I would go about logging in and upgrading on a docker image?

@tj
Copy link
Member

tj commented Nov 20, 2017

Hmm which CI service? Every one I’ve seen lets you edit the commands and env vars so that should be enough hopefully!

@cloudkite
Copy link
Author

@tj I'm using wercker which is based on docker.

Sorry I dont think I made my question clear.

In-order to download the PRO binary you need todo
up account login

which requires input and verification via email? how todo this in a docker image?

@tj
Copy link
Member

tj commented Nov 20, 2017

ahh you can use UP_CONFIG now (baa7fbe#diff-e7fbf301bb4b227cbd056102c31519f1R43 for example), which is the contents of your ~/.up/config.json file. So as long as you can set the AWS env vars and that UP_CONFIG one you should be good to go.

I'll make this easier but for now you can grab the contents with:

$ cat ~/.up/config.json | tr -d '\n'

@cloudkite
Copy link
Author

cloudkite commented Nov 20, 2017

Thanks @tj got it working using up account login --email my@email.com to avoid input on docker

Two things I stumbled across while configuring PRO on CI:

  1. Would be nice to be able to specify a version when you up upgrade so that you can have a predictable version of up PRO on your docker instance and then it would be possible to test and opt into version bumps or rollback if you encounter a breaking change

  2. Docker by default runs in root directory and up account login seems to try use the current dir as app name so ended up get this error:

Error: initializing: reading config: validating: .name "/": must contain only alphanumeric characters and '-'

As a workaround I created a dummy dir so that it wouldnt complain about the dir name

RUN mkdir hello && cd hello && up account login --email my@email.com && up upgrade

@tj
Copy link
Member

tj commented Nov 20, 2017

Totally agree about the upgrade version (#387 if you want to sub), not ideal to fetch any random version that's for sure, I'll try and prioritize that.

Regarding the name issue there, that shouldn't happen if you have a up.json "name" field, by default it uses the directory's name. I might remove that entirely soon though, requiring an up.json file isn't a huge deal (#386)

@cloudkite
Copy link
Author

cool makes sense thanks!

@kaihendry
Copy link

I think I have a working example here:

Bit scary to use my AWS_ACCESS_KEY_ID key here. I wonder if my UP_CONFIG can be tied the a specific AWS_PROFILE. Since I've noticed my UP_CONFIG is actually my work place one.

@lukeed
Copy link

lukeed commented Jan 10, 2018

Posting TJ's guide on Medium just because it's not included yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants