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

Deploy to Fargate #227

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rangerscience
Copy link

@rangerscience rangerscience commented Mar 31, 2019

Hey so I took a swing at making this deployable to AWS Fargate, which is supposed to be the easy host-a-container thing, because I want to be able to turn my computer off without the server going off. Or just because automated the deployment of a game about automation yeeeaaaaah.

Possibly doesn't work, as I had to setup a new AWS account and it looks like it takes time to let me use things like ECS, so I haven't been able to ACTUALLY use it. But everything after this should be "bug fixes", basically. :/

Anyway! It's basically a wrapper script for the existing docker image so that it loads and saves to S3 (Fargate doesn't have persistent storage options) and then "Terraform" configuration to actually setup the cloud infrastructure for hosting.

LMK if this works / what needs changing / etc. :)

@Fank
Copy link
Member

Fank commented Mar 31, 2019

I'm only familiar with google cloud, so someone should check this who knows something about aws

@@ -0,0 +1,8 @@
FROM dtandersen/factorio:latest

RUN apk add --update python py-pip
Copy link
Member

Choose a reason for hiding this comment

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

You should not update any packages if it isn't necessary and you forgot two flags.
I would use apk --no-cache --no-progress add py-pip

Copy link
Author

Choose a reason for hiding this comment

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

I'm not super familiar with APK (or APT, for that matter) but although there IS an APK awscli package, it's still unreleased (edge?) and I couldn't figure out how to install that instead. Otherwise, the python install of the AWS CLI is the simplest set of steps, even if it does balloon the image size :/

Copy link
Member

Choose a reason for hiding this comment

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

That is apk from Alpine and not apt from Debian :).
I was more nitpicking about the --update. I think it is fine to use the ``pip`´ variant but if you are interested you can find it here https://pkgs.alpinelinux.org/package/edge/testing/x86_64/aws-cli

FROM dtandersen/factorio:latest

RUN apk add --update python py-pip
RUN pip install awscli
Copy link
Member

Choose a reason for hiding this comment

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

Combine those two run commands with && \

resource "aws_iam_role_policy_attachment" "factorio" {
role = "${aws_iam_role.factorio.name}"
policy_arn = "${aws_iam_policy.factorio.arn}"
}
Copy link
Member

Choose a reason for hiding this comment

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

You can remove the empty file from git. :)

@rangerscience
Copy link
Author

@Fank Terraform also does GCloud, but I'm not familiar with it, so I didn't put that code in. But take a look, because Terraform is amazing.

@Fank
Copy link
Member

Fank commented Mar 31, 2019

Yea i know, but never used terraform. But GCloud does not have the ability to run a single container, the smallest thing is a complete k8s cluster.

@apeabody
Copy link

While not using Fargate, you might want to look at https://github.com/m-chandler/factorio-spot-pricing which uses ECS on Spot via a CloudFormation template. Likely you only want to run a single Factorio container anyway.

@Fank Fank mentioned this pull request Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants