Deploy a Quarkus App for Free on Railway (No Credit Card)


To deploy a Quarkus app on Railway(For free registration click here), you need to follow these steps:

1. Prepare your Quarkus Application

Ensure that your Quarkus app is working locally. You can test this by running:

./mvnw quarkus:dev

Make sure it works as expected before deploying.

2. Set Up Railway Project

  • If you don’t already have a Railway account, sign up at Railway(click here for registration).
  • Once logged in, create a new project on Railway.

3. Push Your Quarkus App to GitHub

Railway can integrate with GitHub to deploy your app automatically. Push your Quarkus project to a GitHub repository if it's not already there.

4. Create a New Railway Project

  • In your Railway dashboard, click on "New Project."
  • Choose the GitHub integration and connect it to your GitHub repository.
  • Select the repository containing your Quarkus app.

5. Add a Railway Deployment Configuration

Railway automatically detects Java applications and uses the appropriate buildpack. However, you may need to configure the deployment script.

  • In your application.properties (or application.yml), make sure the HTTP port is set to 8080:

    quarkus.http.port=8080
  • If you're using a build tool like Maven, ensure your app is packaged as a JAR or native image that can be run on Railway.

6. Configure Dockerfile (if necessary)

If Railway doesn't automatically detect your Quarkus app, you can create a Dockerfile to guide the deployment process.

Here’s a basic Dockerfile for a Quarkus app:

# Use OpenJDK 17 as base image
FROM openjdk:17-jdk-slim as build

# Set working directory
WORKDIR /app

# Copy the pom.xml and download dependencies (Optional but speeds up builds)
COPY pom.xml ./
RUN ./mvnw dependency:go-offline

# Copy the project files
COPY . .

# Build the application
RUN ./mvnw clean package -DskipTests

# Run the app
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY --from=build /app/target/*-runner.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]

7. Configure Environment Variables

  • If your Quarkus app requires any environment variables (like database URLs, API keys, etc.), you can add them in Railway’s environment settings.

8. Deploy the Application

  • Railway should automatically start building and deploying your application.
  • You can track the progress in the Railway dashboard.

9. Access the Application

  • After deployment, Railway will provide you with a URL to access your Quarkus app.

By following these steps, your Quarkus app should be deployed on Railway.

Popular posts from this blog

Learn Java 8 streams with an example - print odd/even numbers from Array and List

Java Stream API - How to convert List of objects to another List of objects using Java streams?

Registration and Login with Spring Boot + Spring Security + Thymeleaf

Java, Spring Boot Mini Project - Library Management System - Download

ReactJS, Spring Boot JWT Authentication Example

Top 5 Java ORM tools - 2024

Java - Blowfish Encryption and decryption Example

Spring boot video streaming example-HTML5

Google Cloud Storage + Spring Boot - File Upload, Download, and Delete