#airship - December 2018

December 2018
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Documenting is close to folding laundry in my happiness index.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
yea, it’s like pulling teeth
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
haha
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Pulling teeth is short and intense, documenting is more like a week long back pain.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
lol
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
good point
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Hi Everyone, I've started documenting the ecs cluster module here: https://airship.tf/guide/ecs_cluster/. For 'better' English I'll find someone to take a look, but would love to have input from you guys on the structure itself.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
wow maarten! looks great
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Vuerocks 🙂
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
The codeblocks are currently json, very soon hcl 🙂 https://github.com/PrismJS/prism/pull/1594
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
i think you definitely made the right choice for this project
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
going to take a closer look at some of the UI/UX elements and have our guy incorporate that into our docs
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
nice ::: warning
erik
erikalmost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
the writing on this page is exceptional
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@John Shiple you might want to talk with @Maarten van der Hoef about airship for what you guys are doing. It's a great turnkey solution for ECS used by Blinkist, among others.
John Shiple
John Shiplealmost 8 years ago
@John Shiple has joined the channel
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Hi @John Shiple! I'm afk very soon, but happy to talk any time.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Basically they’ve built a very easy turnkey solution for using ECS with Terraform. Cloud Posse has our own modules, but @Maarten van der Hoef is going above and beyond with airship.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
He’s specifically trying to make it easier for smaller startups to get up and running quickly
i5okie
i5okiealmost 8 years ago
@i5okie has joined the channel
i5okie
i5okiealmost 8 years ago
hi
i5okie
i5okiealmost 8 years ago
moved here from general. im trying to implement and automagical experience for our devs to create review apps, after we move from heroku to aws.
i5okie
i5okiealmost 8 years ago
I’m imagining it being almost like circle-ci. by that i mean have “service images” like postgresdb, and other normal images, like ruby-2.3-8-node-browsers kind.
most likely only have a single ecs instance, or cluster of 1, and devs would launch review apps from command line (i’m working on a gem, have a bunch of heroku cli - like features already implemented, this would be next). to either deploy from PR, or from local staged files.
i5okie
i5okiealmost 8 years ago
came here for some inspiration / suggestions / opinions
i5okie
i5okiealmost 8 years ago
looks like traefik will be pretty important
joshmyers
joshmyersalmost 8 years ago
@joshmyers has joined the channel
joshmyers
joshmyersalmost 8 years ago(edited)
@i5okie Is this an unsolved problems that needs code written or is there something you could take off the shelf?
joshmyers
joshmyersalmost 8 years ago
Traefik is 👌
joshmyers
joshmyersalmost 8 years ago
Airship looks nice!
i5okie
i5okiealmost 8 years ago
yeah i was looking at airship too.
i5okie
i5okiealmost 8 years ago
i still don’t really understand how airship can help
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Hu @i5okie I'm not really online now, but tomorrow I'll have plenty of time to show you around what airship is about. I just started documenting ( work in progress ) https://airship.tf . Its guide is only covering the cluster at the moment, the ecs service module which is 99% of the logic isn't covered yet, just a little bit in the (unfinished) getting started section. You can take a look here: github.com/blinkist/terraform-aws-airship-ecs-service . Maybe you can explain your use-case a bit and let's discuss tomorrow !
i5okie
i5okiealmost 8 years ago(edited)
Hmm if i were to use airship, which looks great..
Looking at your guide (great work so far!!!)
I think in my use case I’ll need to replace nginx with Traefik
i5okie
i5okiealmost 8 years ago
i think that’d be a killer combo
joshmyers
joshmyersalmost 8 years ago
Cunning use of the data lambda for bootstrap
joshmyers
joshmyersalmost 8 years ago
@i5okie Have done similar with Traefik and the ECS backend. Worked nicely
i5okie
i5okiealmost 8 years ago(edited)
josh, the only ecs+traefik tutorials I’ve found out there so far. are somewhat useless / not well documented.
i5okie
i5okiealmost 8 years ago
I’m trying to hack together the airship moduel some of the cloud-posse modules, into a nice ecs stack.
then try to figure out how to make a service module to bring-up a traefik service.. one thing at a time i guess 😄
i5okie
i5okiealmost 8 years ago
So is the plan with Airship to bring it into Cloud-Posse family?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
For the time being 😃, I think this is an independent project. But honestly, we just want people doing cool stuff to be part of the community.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
I totally endorse what @Maarten van der Hoef is building with airship + blinkist
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
I know @Jamie Nelson (BitFlight) is contributing to it among others
i5okie
i5okiealmost 8 years ago
i like that 🙂
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
@i5okie I'd love to know how you see your setup working. In my documentation I will have to work-out a few common use-cases. So I'd love to hear yours.
i5okie
i5okiealmost 8 years ago
Im thinking to just use terraform to document the infrastructure for the ecs.
So I’d like to have a small ecs cluster, and some docker images in ecr. like our usual ruby image, then a postgresql / redis service..
I’m still a bit new to this, so im not sure if ruby would be a task or not?

right now we’re primarily on heroku, and have review apps that can get spun up from github PRs.
So in my case, I’d want to write some code that devs would run in their command line to spin up a ‘review app’ (ruby + postgresql + redis images) responding to <app>-<hash>.mydomain.com as per traefik.. then when QA is done verifying or whatever, we can kill the review app afterwords.
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Hi @i5okie I've done something similar with Airship, but less dynamic than your idea. For a QA environment I've created multiple services of the same application, let's call it app running on the same ECS cluster. The 5 different services were preconfigured by terraform and had planet names, earth, mars, uranus etc.
At PR, or however the deployment was configured, the developer creates a branch named app-mars-[JIRA-TICKET] and the application was then deployed to the app-mars ECS Service.
Route53 and a single Application Load Balancer takes care of routing the traffic to the Planet QA ECS Service. A who-is-blocking-what-service-app on Slack takes care of not having developers deploying at the same planet at the time, what never was a problem really.
i5okie
i5okiealmost 8 years ago
yeah that kind of sounds similar.
So i guess in my case, the LB would point to traefik. then traefik would point to one of the deployed apps..
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
What is the need for traefik here, if the ALB already does the routing ?
i5okie
i5okiealmost 8 years ago
auto discovery i guess
i5okie
i5okiealmost 8 years ago
rather uhm reverse proxy
i5okie
i5okiealmost 8 years ago(edited)
i have wildcard *.apps.mydomain.com pointing to traefik. so anything i type in myapp-v3344.apps.mydomain.com traefik would then say ah okay this goes here..
i5okie
i5okiealmost 8 years ago
i5okie
i5okiealmost 8 years ago
except someone who wrote this has incomplete documentation and i can’t get that to work.
i5okie
i5okiealmost 8 years ago
so im trying to do basically the same, but starting with terraform, the airship module, and going from there.
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
I'm seeing where you're getting at now. It's a little different idea from what I'm used to and that makes it interesting. The question is how you want to deploy your others services then. Running terraform at PR ? Or are you ok with pre-configuring a set of services to which you can deploy after.
i5okie
i5okiealmost 8 years ago
so lets forget about PRs for now
i5okie
i5okiealmost 8 years ago
i want to have this in terraform so its documented, in case we need to tear down the stack and bring it up in the future. or on another aws account.. etc.
i5okie
i5okiealmost 8 years ago
so for other services.. I was thinking if it’d be possible to do something like how CircleCi config file has the main -image ruby:2.5 for example, and then below you specify -image postgresql:9.6-alpine for example..

so i think that when ‘deploy command’ is triggered, i’l have to spin up the ruby image, and the postgresql/ redis images and then associate those three together. (this probably has nothing to do with terraform at this point)
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
I've used RDS in a shared tenancy model for that as production is also using RDS and I like to have production more or less in sync with everything else
i5okie
i5okiealmost 8 years ago
what i’ve described above would be insane for production. its for ephemeral apps with like short life-spans of a couple minutes to a couple days tops.
i5okie
i5okiealmost 8 years ago
it’s quite a challenge lol. i’ve never done anything like this before
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Let me know if if you struggle with something on the way! The mindset behind the airship modules is slightly different from your use-case but we're engineers, so we can make everything work 🙂
i5okie
i5okiealmost 8 years ago
yep, i have to run out for a bit. but i have a question about your config example
i5okie
i5okiealmost 8 years ago
tty soon 🙂
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
sure, just post!
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
I use airship and cloudposse combined. I like to add the null_label into airship, so i can cascade the conststant labeling and tagging down through all the modules via context.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
I have used Traefik, and it is easy to add into the mix
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
IF I get a moment, i'll build up an example
Ryan Ryke
Ryan Rykealmost 8 years ago
@Ryan Ryke has joined the channel
rss
rssalmost 8 years ago
0.8.4: Task scheduler fix (#27)
What

Rewrite of the javascript Task scheduler, it wasn't working properly with AWSVPC networking.
Limited the name of the jobs to 32 chars.
Fixed a bug which effected ecs services without a load balancer as the condition was still set to match NONE instead of none
i5okie
i5okiealmost 8 years ago
I fell off the earth.. looks like my project has been scrapped for the foreseeable future ;(. But now I’ll be playing with Airship the way it was designed haha
i5okie
i5okiealmost 8 years ago
The question I had was… vpc_security_group_ids = ["${module.ecs_instance_sg.this_security_group_id}","${module.admin_sg.this_security_group_id}"]
What is the intent with these SGs? Or what are the suggested rules?
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago(edited)
The Autoscaling Group of instances needs to allow incoming traffic from the Load Balancer. I'm describing it here :https://airship.tf/guide/ecs_cluster/#security-groups
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
have you taken a look at the new blue/green deployment feature?
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
How to spend a weekend. My start on the ECS service documentation.. https://airship.tf/guide/ecs_service/
Would love to have input on anything guys!
erik
erikalmost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
love these diagrams 😃
erik
erikalmost 8 years ago
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Love them too 🙂 If you have time please tell me what you don't like!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
this is the most documented terraform module on the internet 😃
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
I'll have to wear sunglasses outside now.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
hahah
Steven
Stevenalmost 8 years ago
@Steven has joined the channel
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
@Jamie Nelson (BitFlight) https://github.com/blinkist/terraform-aws-airship-ecs-service/blob/service_discovery/modules/ecs_service/main.tf With SRV record as DNS type the Service doesn't get registered, do you have any idea ?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Do you have an example set up using it currently?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
that you can make a change to and test?
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago(edited)

  resource "aws_service_discovery_private_dns_namespace" "example" {
    name        = "example.terraform.local"
    description = "example"
    vpc         = "${module.vpc.vpc_id}"
  }

module {
 enable_service_discovery = true

    service_discovery_namespace_id = "${aws_service_discovery_private_dns_namespace.example.id}"
}
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
can you comment out the port line
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Isn't the port needed for SRV ?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
# port = "${var.container_port}"
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
No. I've just read through my code and my collegues code where we ahve used srv records.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
and never actually added the port value tehre
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
I just want to see if that is doing anything funny
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
even though it is mentioned in the tf documentation
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
The Service Discovery instance could not be registered.
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Task comes up, is healthy
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
But is it working with A records?
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
then gets killed
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
yes
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
can try again
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
maybe MULTIVALUE routing with SRV is the problem ?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
no, it can do it
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
But try toggling that... andthen also try commenting out

  # Needed for private namespaces
  health_check_custom_config {
    failure_threshold = "${var.service_discovery_healthcheck_custom_failure_threshold}"
  }
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Since it may also be the helth check modifiers that do it
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
ok, now also have the same with A records, not sure what changed then.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
ok good. At least we know its not srv now
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
You didn't accedentally create a terraform.local route53 zone did you?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago(edited)
as well as the example.terraform.local zone
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
no, they make it
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
'they' 🙂
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
the borg
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
hehe
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
no change
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Can you do a destroy and apply?
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
just the service or also the namespace ?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
namespace too
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
if you can easily do it
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Also, what network mode are you using?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
awsvpc? or host/bridge
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
awsvpc
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
same shit, i give up for now
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
@Jamie Nelson (BitFlight) @jonboulle If you want to have another avatar or introduction next to your name, let me know 🙂

Also, if you can write better than me, let me know 🙂

https://airship.tf/introduction/
niek
niekalmost 8 years ago
@niek has joined the channel
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
@niek is also an author of ECS modules, happy to have you here 🎉
niek
niekalmost 8 years ago
@Maarten van der Hoef thx
rss
rssalmost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
welcome @niek!
ulich
ulichalmost 8 years ago
@ulich has joined the channel
ulich
ulichalmost 8 years ago
Hi everyone. First, thanks for your ECS terraform modules! I was following the instructions https://airship.tf/getting_started/ to set up a fargate cluster but i am getting 6 value of 'count' cannot be computed errors as soon as I add the ecs_service module:


* module.ecs_service_nginx.module.alb_handling.aws_lb_listener_rule.host_based_routing_ssl_custom_listen_host: aws_lb_listener_rule.host_based_routing_ssl_custom_listen_host: value of 'count' cannot be computed
* module.ecs_service_nginx.module.alb_handling.aws_lb_listener_rule.host_based_routing_custom_listen_host: aws_lb_listener_rule.host_based_routing_custom_listen_host: value of 'count' cannot be computed
* module.ecs_service_nginx.module.alb_handling.aws_lb_listener_rule.host_based_routing_ssl_custom_listen_host_cognito_auth: aws_lb_listener_rule.host_based_routing_ssl_custom_listen_host_cognito_auth: value of 'count' cannot be computed
* module.ecs_service_nginx.module.alb_handling.aws_route53_record.record_alias_a: aws_route53_record.record_alias_a: value of 'count' cannot be computed
* module.ecs_service_nginx.module.alb_handling.aws_lb_listener_rule.host_based_routing_custom_listen_host_redirect_to_https: aws_lb_listener_rule.host_based_routing_custom_listen_host_redirect_to_https: value of 'count' cannot be computed
* module.ecs_service_nginx.module.alb_handling.aws_route53_record.record: aws_route53_record.record: value of 'count' cannot be computed


I am using terraform 0.11.11 and I was able to provision all resources, once I add the ecs_service module it fails
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Hi @ulich thnks, That's a lot of errors, and they don't make much sense to me. Could you post a GIST of your sample code & terraform plan. Tomorrow I have some time, but I'm traveling as well.
joshmyers
joshmyersalmost 8 years ago
@Maarten van der Hoef Airship in DevOps weekly, nice!
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Oh cool, I'm not even subscribed, do you want to fwd that to me ?
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
let's see if I can get it if I subscribe now
joshmyers
joshmyersalmost 8 years ago
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
I subscribed but not getting the old one I think, can't find any active archives.
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Close to finishing service discovery, @Jamie Nelson (BitFlight) do you have time to take a look ? branch:service_discovery

  service_discovery_enabled = true

  service_discovery_properties {
    namespace_id                         = "${aws_service_discovery_private_dns_namespace.test.id}"
    dns_ttl                              = "60"
    dns_type                             = "A"
    routing_policy                       = "MULTIVALUE"
    healthcheck_custom_failure_threshold = "1"
  }
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Hi merry Xmas - did you manage to fix the weird issue with it?
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
merry xmas!
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
yes, i don't have it anymore, also I found a way to disable container_port now for A type records but setting it to false .. 🙂
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Ah good. I can’t do the pr right now as I’m out of my hotel. But I can within 24 hours!
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
I'm at schiphol 🙂 this video is loading very slowly
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
haha
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
nice one
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Reviewed the changes. There is one instance of var.tags when it should be local.tags
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)almost 8 years ago
Apart from that, approved!
rss
rssalmost 8 years ago
0.8.6: Service discovery (#28)
Added service discovery..
service_discovery_enabled = true
service_discovery_properties {
namespace_id = "${aws_service_discovery_private_dns_namespace.test.id}"
dns_ttl = "60"
dns_type = "A"
routing_policy = "MULTIVALUE"
healthcheck_custom_failure_threshold = "1"
}
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Next stop, Traefik 🙂
Jesse Bye
Jesse Byealmost 8 years ago
@Jesse Bye has joined the channel
tweetyix
tweetyixalmost 8 years ago
@tweetyix has joined the channel
Maarten van der Hoef
Maarten van der Hoefalmost 8 years ago
Welcome aboard @Jesse Bye and @tweetyix! I'm off for new years partying in Belgrade until the 2nd of January, most likely afk. If there's anything I can help you with, let me know and I'll get back to you when I can.