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

Add shutdown duration option to Node.js simple #1413

Merged
merged 7 commits into from
Mar 23, 2020

Conversation

steven-supersolid
Copy link
Collaborator

The example code now reads the first argument if specified
If --help is passed then will exit with a help message
If a number is passed then that will be used for the shutdown duration

Converted setTimeout to use await to make code clearer
Updated watch to give more relevant information set during the test
Clear intervals correctly so these don't prevent the app from exiting
Found the app still won't exit cleanly so potentially a bug in sdk.close() (fix as separate PR)

Updated Makefile and dockerfile to pass in a parameter
Updated documentation

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 6200d550-c35c-404d-9503-9563df736a67

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 2cc2c5f5-db05-4272-981c-3cf6507cbcab

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1413/head:pr_1413 && git checkout pr_1413
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.5.0-bf7f10e

@@ -43,7 +43,7 @@ build:
cd $(root_path) && docker build -f $(project_path)/Dockerfile --tag=$(server_tag) .

run:
docker run --network=host $(server_tag)
docker run --network=host $(server_tag) $(args)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff - will be useful for testing #1299 👍

We should also increment the tag version in this file, so we can rebuild and push it up for people to use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that be server-tag and should it be 1.5 now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server_tag = $(REPOSITORY)/nodejs-simple-server:0.3 ➡️ server_tag = $(REPOSITORY)/nodejs-simple-server:0.4

It will
- Setup the Agones SDK
- Call `sdk.ready()` to register that it is ready with Agones.
It will:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to document what the command is (or the Docker run command?) should be to run this for longer than 60 seconds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is documented around line 120 after example debug output but perhaps clearer if I reorder?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also like the explicit command line argument documented.

Or is it just "120" as seconds ? Should we use a key-value pair? Like --timeout=120 ?

Would be much more explicit, and also expandable down the line. WDYT?

@@ -1,6 +1,6 @@
{
"dependencies": {
"@google-cloud/agones-sdk": "1.3.0"
"@google-cloud/agones-sdk": "1.4.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps should update as part of the release @markmandel ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary, unless there is a code change in either the SDK or the example.

Unless you can see a good reason to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason would be to keep the code sample up to date and consistent with the release. We could also change to a non-pinned dependency

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if there is no public API code change between versions, then it is up to date with the latest release 😄

@roberthbailey roberthbailey removed the request for review from EricFortin March 16, 2020 05:54
Please note that there is a max sleep time in Node.js of 2,147,483 seconds (~24 days). Values will be capped at this and negative values or zero will also be set to this.
So to keep the server alive for a long time you could use the following:
```
$ make args="0" run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make these (no pun intended 😄 ) the full Docker run command.

That way people don't need to pull down the full example source code -- and can also replicated within their Agones install as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sure. I was just basing this on the previous instructions. I usually run with npm start anyway.
If there's a need for both should we have both ways of running?
@roberthbailey you wrote the original README - any thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, if it's been this way for a while, I'll be less opinionated on changing to Docker run... but it still would be nice I think?

@markmandel markmandel added area/examples Examples. Usually found in the `examples` directory kind/feature New features for Agones labels Mar 17, 2020
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 325f15de-12c4-4747-b774-66a36148bc0a

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1413/head:pr_1413 && git checkout pr_1413
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.5.0-1e395fd

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: dcd796ae-6334-43a8-bdfd-6e95c371f193

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 1a9f601d-f449-4d44-ae67-c8ee600e4f5e

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1413/head:pr_1413 && git checkout pr_1413
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.5.0-9e2deff

You can optionally specify how long the server will stay up once the basic tests are complete with the `--timeout` option.
To do this pass arguments through, e.g. to increase the shutdown duration to 120 seconds:
```
$ make args="--timeout=120" run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this! 😄

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran a local test - all looks good!

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markmandel, steven-supersolid

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@markmandel
Copy link
Member

Weird, I can't update this branch to master. There is no button?
image

@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@steven-supersolid
Copy link
Collaborator Author

Wonder if it's because I merged without the button last time? But I had the button just now, so pressed it :)

@markmandel
Copy link
Member

I'll wait for this to run through, and then it gets to be first in the queue 😄

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 6e3a431f-1496-4bf1-85bf-f0114befa547

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1413/head:pr_1413 && git checkout pr_1413
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.5.0-f4a563f

@markmandel markmandel merged commit 8487128 into googleforgames:master Mar 23, 2020
@markmandel markmandel added this to the 1.5.0 milestone Mar 23, 2020
@steven-supersolid steven-supersolid deleted the nodejs-soak-option branch April 26, 2020 12:33
ilkercelikyilmaz pushed a commit to ilkercelikyilmaz/agones that referenced this pull request Oct 23, 2020
* Add optional shutdown duration. Update makefile and docs
* Fix dockerfile to pass through params
* Improve options handling. Fix Makefile on Windows. Update documentation. Update server version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/examples Examples. Usually found in the `examples` directory kind/feature New features for Agones size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants