We make self-hosting easy

    More Articles

Deploying Your App on KubeSail

How to deploy Node.JS, Python, and Rails apps into Kubernetes

This post is by pastudan
Dan Pastusek
July 8, 2019

Node.JS

We've created deploy-node-app as a migration tool to help you deploy your existing Node.js application into Kubernetes. If you have not yet created an app, you can use create-node-app to bootstrap a new app with React, Express, Postgres, and Redis with one command.

Python

Create a Dockerfile

You can create an image containing your app by placing a file called Dockerfile in the root of your project. Update the line with your-daemon-or-script.py.
FROM python:3

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./your-daemon-or-script.py" ]

Ruby on Rails

Create a Dockerfile


FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp

EXPOSE 3000

# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]

Building your image

Run
docker build . -t username/your-image-name
docker push username/your-image-name
with username being your Dockerhub username.

Deploying your app to KubeSail

Once you've built your image and pushed to Docker hub, deploying it to KubeSail is simple! Just update the image section of the config below, and then hit apply.

Stay in the loop!

Join our Discord server, give us a shout on twitter, check out some of our GitHub repos and be sure to join our mailing list!