This guide provides a general overview of how to deploy your PropertyWebBuilder application to Northflank. As there is no specific documentation from Northflank for deploying Rails applications, this guide assumes you will be deploying a Dockerized version of your application.
- A Northflank account.
- Your application code pushed to a Git repository.
- A
Dockerfilein your project's root directory.
If you haven't already, you'll need to create a Dockerfile for your Rails application. Here is a basic example:
# Use the official Ruby image
FROM ruby:3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set the working directory
WORKDIR /app
# Copy the Gemfile and install gems
COPY Gemfile Gemfile.lock ./
RUN bundle install
# Copy the rest of the application code
COPY . .
# Precompile assets
RUN bundle exec rails assets:precompile
# Expose port 3000
EXPOSE 3000
# Start the Rails server
CMD ["rails", "server", "-b", "0.0.0.0"]- Log in to your Northflank dashboard.
- Create a new Service.
- Choose your Git repository and branch. Northflank will detect your
Dockerfileand use it to build your application.
- Ports: Northflank will typically detect the exposed port from your
Dockerfile. Ensure that port 3000 is correctly configured. - Environment Variables: Add your
RAILS_MASTER_KEYand any other required environment variables. - Database: Create a new PostgreSQL database addon in Northflank. Once created, you can get the connection string and add it to your service's environment variables as
DATABASE_URL.
Once your service is configured, Northflank will automatically build and deploy your application. You can monitor the build and deployment logs in the Northflank dashboard.
After your service is deployed, you will need to run your database migrations. You can do this by opening a one-off job or a command-line session into your running container and executing:
bundle exec rails db:migrate