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

Anyone using Meteor 2.x.x can use the below dockerfile,

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

# 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:14-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 \
		python3 \
	# 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"]

By the way, I have a question to @jam & @cereal , How did you set METEOR_SETTINGS in Railway environment vars ? coz it’s only asking for key - string pair, where as settings is a JSON.

1 Like

You should be able to simply copy and paste in the JSON

1 Like

As jam said, you just use a string that contains json.

As for the dockerfile, Disney (of all companies) maintains a meteor dockerfile for each version here: disney/meteor-base: Base Docker image for use by Meteor apps (github.com)

That’s what I’ve been using lately.

2 Likes

If you are looking for an easy way to deploy your Meteor app try https://zcloud.ws

We have features dedicated to Meteor, for example, METEOR_SETTINGS special env var.

You can read about it here. If you need help we can prepare the deployment with you but in general we auto-detect your Meteor version so you don’t need to even inform a Dockerfile

1 Like

I dare say requiring a phone call to talk about your business is a teeeeny bit harder than railway

We don’t require a call, but yes, we verify every single account as we want to build relationships and understand the needs of every client.

I know that is not common, but we are doing it differently on purpose.

Our system is designed to be used for our clients with a lot of freedom and flexibility, but we love to get into calls (when possible) to get to know our clients better.

It is a very different business model than the Railway for sure.