Best method of deploying to AWS

Hi!

We’ve been using Heroku and the GitHub - AdmitHub/meteor-buildpack-horse: Heroku buildpack for Meteor v1.0+. The horse one. buildpack to successfully deploy production apps. It’s got a decent workflow with a good set of tools and utilities and a pipeline.

We’d like to migrate to AWS. What’s the consensus on the best methodolgy to do so? I’ve read about Meteor UP. Will things not be as automated on AWS bc of us having a dedicated linux VM and needing to manually setup start scripts, DBs, and what not?

AWS Marketplace: Meteor looks convenient

Probably MUP. Also waveshosting.com is decent.

1 Like

Meteor UP uses dockers. If you prefer a more bare metal approach, you can try yamup.

1 Like

Our preference is using published docker images and ECS Fargate. Our docker image is based on https://github.com/disney/meteor-base but we opted to simplify it to not use multistage and modify it to our needs.

The build script is basically

  1. Build tgz bundle using meteor build
  2. Build Dockerfile using an alpine base image
    • Add prerequisites
    • Copy in bundle
    • Build native npm packages (like bcrypt)
  3. Push docker image to private repo

Deployment:

  1. Modify ECS settings using the method described here

Our Dockerfile, for reference:

# For Meteor 1.11.1
FROM node:12.18.4-alpine3.11

# https://github.com/nodejs/docker-node/issues/339
# RUN apk add --update --no-cache bind-tools curl jq

RUN apk add tzdata && cp /usr/share/zoneinfo/Europe/Stockholm /etc/localtime

# you need to copy the bundle to the .docker dir first since Dockerfiles cannot escape their root directory
ARG BUNDLE_PATH=./bundle/bundles/RefappBundle.tgz

ARG GIT_HASH
ENV GIT_HASH $GIT_HASH

ARG DOCKER_TAG
ENV DOCKER_TAG $DOCKER_TAG

ENV APP_BUNDLE_FOLDER /opt/bundle
ENV SCRIPTS_FOLDER /docker

ARG ECS_TASK_TEMPLATE={}

LABEL ECS_TASK_TEMPLATE $ECS_TASK_TEMPLATE

# Install OS build dependencies, which we remove later after we’ve compiled native Node extensions
RUN apk --no-cache --virtual .node-gyp-compilation-dependencies add \
		g++ \
		make \
		python \
	# And runtime dependencies, which we keep
	&& apk --no-cache add \
		bash \
		ca-certificates

# Copy in scripts and supporting files
COPY ./.docker/scripts/ $SCRIPTS_FOLDER/

# prep for the entrypoint script
RUN cd $SCRIPTS_FOLDER && npm install --production

# Copy in app bundle from tarball
ADD $BUNDLE_PATH $APP_BUNDLE_FOLDER/bundle

# Build native extensions
RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh \
	&& apk del .node-gyp-compilation-dependencies

ENV NODE_ENV production

# Start app
ENTRYPOINT ["/docker/entrypoint.sh"] 

CMD ["node", "main.js"]
2 Likes