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

Speed up deployments #2562

Closed
2 tasks done
iperdomo opened this issue Mar 27, 2018 · 4 comments
Closed
2 tasks done

Speed up deployments #2562

iperdomo opened this issue Mar 27, 2018 · 4 comments
Assignees

Comments

@iperdomo
Copy link
Contributor

iperdomo commented Mar 27, 2018

The current approach to make deployments is a serial process. Going one by one and calling ant update. This process makes unnecessary work as the only change between instances is appengine-web.xml. It seems that deploying all active instances take ~8h which is too much.

We need to:

  • Avoid unnecessary work
  • Investigate the possibility of using a pull based approach instead of pushing the release to each instance.
@iperdomo iperdomo self-assigned this Mar 27, 2018
@iperdomo
Copy link
Contributor Author

To avoid unnecessary work the deployment process will build the Dashboard (JS) and compile the application once, then change only the config file appengine-web.xml per instance

@iperdomo
Copy link
Contributor Author

Related to a pull based approach, we have successfully deployed a Flow instance using the Google App Engine Admin API

The idea is that we can create a new version (or update an existing one) by making a POST request to the admin API with a Version request.

The Version request is a JSON payload that contains the list of files and a pointer fo a Google Storage bucket url from where the instance and pull the files for deploying a new version.

@iperdomo
Copy link
Contributor Author

There are some unknowns on how to translate the <security-constraints> to handlers as the app.yaml or app.json requires. So the strategy for deployments will be the following:

  • Deploy the application using gcloud to a known and default instance (e.g. akvoflowsandbox)
    • The gcloud app deploy uses a Google Storage bucket to upload the files that will be the source of the deployment
  • After a successful deployment of version 1 and dataprocessor we use the Google App Engine Admin API to GET the current definition of the version of the recently deployed known instance. This will produce a JSON payload similar to the one we need for making POST requests.
  • We take that JSON definition of the version and change the link to the appengine-web.xml (the only file that changes) and make a POST to update a version to another known instance (e.g. uat1)
  • We verify that the new deployment went OK by making a couple requests to known URLs
  • After verification, we loop through a list of instances to deploy making the same POST request with the only change of the link to appengine-web.xml
    • This can be a serial POST but the caller doesn't need to wait for completion. We get a operation id that we can check few minutes later for status (and keep polling until is done)

iperdomo added a commit that referenced this issue Apr 11, 2018
- We use a docker container to have more control of the environment
- Every time a developers wants to deploy, she/he needs to login
- The current approach is to deploy artifacts from local disk,
  in a next iteration we'll download a .war from a bucket
iperdomo added a commit that referenced this issue Apr 11, 2018
- We expect that the ${version}.war file exists in the same bucket
  used for deployments
iperdomo added a commit that referenced this issue Apr 17, 2018
* To avoid developer local changes we clone the config repository
  as part of the deployment
* To avoid issues with ssh keys we clone the repo using https, but
  requires the developer with 2FA enabled, to have a personal token
  to be used as password
* After POST to a known instance (akvoflow-dev2) we attempt to verify
  that the operation was done
iperdomo added a commit that referenced this issue Apr 17, 2018
iperdomo added a commit that referenced this issue Apr 18, 2018
* When running the script we can export GH_USER and GH_TOKEN to
  clone the config repo
* We use parallel to execute the `deploy_instance` function
* Mount $PWD/tmp as /tmp inside the container to keep the logs
iperdomo added a commit that referenced this issue Apr 18, 2018
- Remove extra checks for deployment
iperdomo added a commit that referenced this issue Apr 18, 2018
dlebrero added a commit that referenced this issue Apr 19, 2018
Using manual scaling as per configuration in akvoflow-59
iperdomo added a commit that referenced this issue Apr 23, 2018
dlebrero added a commit that referenced this issue Apr 23, 2018
[#2562] Upload artifact (.war) when deploying (connect #2562)
iperdomo added a commit that referenced this issue Apr 25, 2018
- Run `delegated` mount to speed things up in MacOS
  https://docs.docker.com/docker-for-mac/osxfs-caching/
- Use `-z` to check for existing GH_USER and GH_TOKEN variables
@muloem
Copy link
Member

muloem commented May 4, 2018

@iperdomo There is a small issue with the script. Even when the GH_USER and token environment variables are set, I still get a prompt to enter them.

iperdomo added a commit that referenced this issue May 7, 2018
- Instead of dealing with empty 'null' values via `-z` comparison
  we use a predefined missing value `unknown`
iperdomo added a commit that referenced this issue Jan 8, 2020
When pushing the .jar file to clojars, a new file gets created:
`maven-metadata-clojars.xml.sha1` this triggers the CI cache to
be refreshed
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

3 participants