Railway might be the easiest way to host a meteor app

It’s not really out yet, but https://railway.app is looking to be the easiest way to host a meteor app. I wouldn’t host anything production on it since we don’t know how much that will cost, but it’s something to keep on your radar.

I hosted a super quick test, and it was fairly painless. I created a project on railway, added the mongo plugin, set my ROOT_URL, MAIL_URL, and METEOR_SETTINGS env vars in the UI, then ran

railway login
railway init
railway up

It was available in a few minutes.

This is the dockerfile I used:

# The tag here should match the Meteor version of your app, per .meteor/release
FROM geoffreybooth/meteor-base:1.11

# Copy app package.json and package-lock.json into container
COPY ./package*.json $APP_SOURCE_FOLDER/

RUN bash $SCRIPTS_FOLDER/build-app-npm-dependencies.sh

# Copy app source into container
COPY . $APP_SOURCE_FOLDER/

RUN bash $SCRIPTS_FOLDER/build-meteor-bundle.sh


# Use the specific version of Node expected by your Meteor release, per https://docs.meteor.com/changelog.html; this is expected for Meteor 1.9
FROM node:12.16.1-alpine

ENV APP_BUNDLE_FOLDER /opt/bundle
ENV SCRIPTS_FOLDER /docker

# 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 entrypoint
COPY --from=0 $SCRIPTS_FOLDER $SCRIPTS_FOLDER/

# Copy in app bundle
COPY --from=0 $APP_BUNDLE_FOLDER/bundle $APP_BUNDLE_FOLDER/bundle/

RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh --build-from-source \
	&& apk del .node-gyp-compilation-dependencies

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

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

@cereal curious if you’re still playing around with Railway. I’m giving it a go with your Dockerfile above (with updated meteor and node versions). I can see the app running locally after railway run but for some reason I’m not having luck with railway up. I’m seeing:

Laying tracks in the clouds... read .meteor/local/build/programs/server/node_modules: is a directory

Any ideas?

EDIT

Seems like there might be an issue with the railway CLI. Deploying with their github integration works fine.

fyi for others, I also set PORT to get rid of a Railway warning