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

Update tests and compose files #7

Merged
merged 13 commits into from
Apr 20, 2017

Conversation

jasonpincin
Copy link
Contributor

@jasonpincin jasonpincin commented Mar 9, 2017

Updated examples, added many comments. Added small example web server, using the AutoPilot pattern, to read values from Redis. Updated tests.

- CONSUL=consul
links:
- consul:consul
ports:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a comment here about how this and most of the other ports declarations should not be open for production, at least on Triton?

See also autopilotpattern/wordpress#44

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we just do one better and remove these exposed ports? They're not needed for any example or blog post.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is easier to experiment with them when open, and for somebody not familiar with Triton, it's kind of important to explain.

Copy link

Choose a reason for hiding this comment

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

Also: expose and ports are redundant if they are the same values.

image: autopilotpattern/redis:3.2.8-r1.0.0
mem_limit: 512m
restart: always
expose:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the expose stanza repeated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed it is sir.

network_mode: bridge

webserver:
image: jasonpincin/ap-redis-example-webserver:1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Where's the code for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad. It's in examples/webserver

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can publish this as autopilotpattern/ap-redis-example-webserver:1.0.0, was just publishing under my scope while iterating on the blog post and testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather not use an ap prefix on any images in our namespace, but autopilotpattern/redis-example-webserver:1.0.0 looks good to me.

local keyId=/$MANTA_USER/$MANTA_SUBUSER/keys/$MANTA_KEY_ID
local keyId=/$MANTA_USER/keys/$MANTA_KEY_ID
if [[ "${MANTA_SUBUSER}" != "" ]]; then
keyId=/$MANTA_USER/$MANTA_SUBUSER/keys/$MANTA_KEY_ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the first implementation to actually support subusers? Right on.

@tgross
Copy link

tgross commented Mar 21, 2017

Mostly LGTM, but what's the reasoning for decoupling the tests from the examples? Seems like the sort of thing that will potentially get out of sync.

restart: always
mem_limit: 128m
labels:
- triton.cns.services=redis-consul
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for namespacing this.

@misterbisson
Copy link
Contributor

This looks pretty good. I think the example Compose files could use some inline comments, but I've got no other concerns.

services:
redis:
image: autopilotpattern/redis:3.2.8-r1.0.0
mem_limit: 4g
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this do better with either a g4-general-4G or even a g4-highram-16G package?

Copy link
Contributor

Choose a reason for hiding this comment

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

redis:
image: autopilotpattern/redis:3.2.8-r1.0.0
mem_limit: 4g
restart: always
Copy link
Contributor

Choose a reason for hiding this comment

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

# Joyent recommends setting instances to always restart on Triton

mem_limit: 4g
restart: always
labels:
- triton.cns.services=redis
Copy link
Contributor

Choose a reason for hiding this comment

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

# This label sets the CNS name, Triton's automatic DNS
# Learn more at https://docs.joyent.com/public-cloud/network/cns

- triton.cns.services=redis
environment:
- CONTAINERPILOT=file:///etc/containerpilot.json
- affinity:com.docker.compose.service!=~redis
Copy link
Contributor

Choose a reason for hiding this comment

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

# This helps distribute Redis instances throughout the data center
# Learn more at https://www.joyent.com/blog/optimizing-docker-on-triton#controlling-container-placement

env_file: _env
network_mode: bridge

consul:
Copy link
Contributor

Choose a reason for hiding this comment

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

This may deserve a comment about what Consul does, why it's here, etc.

command: >
/usr/local/bin/containerpilot
/bin/consul agent -server
-bootstrap-expect 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment about how to switch this so it runs as an HA, multi-node cluster, as in https://github.com/autopilotpattern/wordpress/blob/master/docker-compose.yml#L20-L21 ?

restart: always
mem_limit: 128m
ports:
- 8000
Copy link
Contributor

Choose a reason for hiding this comment

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

Run this on port 8000 on Triton?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The example app was hard-coded to run on 8000, so that it worked locally. I could change the app to accept a PORT env var and listen on that, then pass that in... it complicates the example a bit, so I didn't bother. You have another preference?

Copy link
Contributor

Choose a reason for hiding this comment

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

Eh...meh.

@jasonpincin
Copy link
Contributor Author

@tgross

Mostly LGTM, but what's the reasoning for decoupling the tests from the examples? Seems like the sort of thing that will potentially get out of sync.

https://github.com/joyent/blog/pull/308#discussion_r105173417

@jasonpincin
Copy link
Contributor Author

jasonpincin commented Mar 21, 2017

Per conversation with @tgross, I'm going to ditch the idea of having a separate set of compose files for CI, use those in examples, and just update test harness to generate _env file.

@jasonpincin jasonpincin changed the title Decouple tests Update tests and compose files Mar 24, 2017
@misterbisson
Copy link
Contributor

:pickles:

@jasonpincin
Copy link
Contributor Author

@misterbisson I know you already gave pickles, but one last push which has the harness create the _env now so that the examples look to users like they should. If still pickles, I'll merge this.

@misterbisson
Copy link
Contributor

:pickles:

@misterbisson misterbisson merged commit 7588d9c into autopilotpattern:master Apr 20, 2017
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

Successfully merging this pull request may close these issues.

3 participants