tulik / symfony-4-docker-env

Docker Environment for Symfony. PHP-FPM, NGINX SSL Proxy, MySQL, LEMP
MIT License
118 stars 60 forks source link

More explanation about Travis and GCE configuration. #8

Open woprrr opened 6 years ago

woprrr commented 6 years ago

Hi tulik,

I continue to use this part of helm/ and .travis files in my own project for API rest with DDD layers. But I really not understand how I do configure travis file and what variables we need to add ?

@see https://travis-ci.org/woprrr/SF4-Rest-API/jobs/396913196 an example of openssl error.

to generate my own client_secrets.json I have dowloaded from GCE project and encoded with travis encrypt-file client_secrets.json --add command. The .travis file was updated with correct values (I think :D) but IV error ...

Can you add some docs or explain me how that works ?

I purpose to add anything like 👍 `

  1. Install and login to the Travis CLI: $ gem install travis $ travis login
  2. Move your json private key to client_secrets.json
  3. Run: $ travis encrypt-file client_secrets.json --add
  4. Commit changes: $ git add client_secrets.json.enc $ git commit client_secrets.json.enc .travis.yml `

But this seems not suffisent ... Thank a lot for your work !

tulik commented 6 years ago

@woprrr Have you manage to solve your issue already? Currently, I have little time to create a step by step instruction, but it's definitely in my todos.

If you already found a solution could you please contribute it? Both main and helm README files need an update.

woprrr commented 6 years ago

@tulik Unfortunately, I tried many things without having a satisfactory result and that's why I came here to find more resources and explanation on how to do it?

I have for the moment let down and I deploy by hand but it is definitely in my todos to try to propose a doc on this subject too. If it is possible I want you to provide me with a resource to see how to proceed and I formalize it here for you with great pleasure !!

tulik commented 6 years ago

Do you have encrypted_xxxxxxxxxxxx_iv and encrypted_xxxxxxxxxxxx_key set? You need to set them and GCLOUD_PROJECT in

Travis > Settings > Environment Variables

woprrr commented 6 years ago

No, I do follow this to generate it? https://github.com/alrra/travis-scripts/blob/master/docs/github-deploy-keys.md#26-set-up-ssh-connection-for-travis-ci

the GCLOUD_PROJECT that the name of GCE side right?

tulik commented 6 years ago

Go to the Google Cloud Console Dashboard:

  1. Enable Google App Engine Admin API,
  2. Go to Credentials, click Add Credential and Service account key, click JSON.
  3. Save your JSON file into your GitHub project directory as client_secrets.json

Install Travis and encrypt JSON file:

  1. gem install travis
  2. travis login
  3. travis encrypt-file client_secrets.json --add

Then go to Travis website, select your project and:

  1. Click More options and look for Environment Variables,
  2. Add GCLOUD_PROJECT variable - it is your GCE project ID,
  3. Grab your variables names like - encrypted_xxxxxxxxxxx_key and encrypted_xxxxxxxxxxx_iv,
  4. In .travis.yml replace in $encrypted_6797df738197_key and $encrypted_6797df738197_iv with your variables names.

Remove or move your client_secrets.json (to be sure won't add to the git repository)

Hope it will help.

woprrr commented 6 years ago

@tulik Oh wonderfull !!!! That works now !

will purpose the PR to add more doc in readme of how configure travis and GCE :) Thanks !! I'm a little curious about same thing on AWS now :D ?

In my test Fork for my projects (https://travis-ci.org/woprrr/symfony-4-skeleton-docker/jobs/406286386#L3165) the Travis failed in varnish step have you an idea of problems by the way :) ?

Thank you a lot !!!

tulik commented 6 years ago

Following command is failing: The commnd "linux-amd64/helm del --purge $GCLOUD_PROJECT" exited with 1.

It errors because build script is missing check if release exists To make it work you can to create release manually or remove this line on a very first build.

It needs improvement. Sorry about that.

woprrr commented 6 years ago

Oh ! I add this in my PR too.

Now it's equal as my local tests ...

https://travis-ci.org/woprrr/symfony-4-skeleton-docker/jobs/406336336#L3165

what's get pods errors during helm install

tulik commented 6 years ago

@woprrr It's not super straightforward but you can see it works with your changes :)

tulik commented 6 years ago

Ping @woprrr