Skip to content

Commit a4c2536

Browse files
committed
minor fix
1 parent 0d177b8 commit a4c2536

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

docs/concepts/railpack.mdx

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
title: Railpack
3+
description: Defang will use Railpack to make an OCI-Compliant container image for your project.
4+
sidebar_position: 500
5+
---
6+
7+
8+
9+
# Railpack
10+
11+
[Railpack](https://railpack.com/) is a tool for building container images from source code with minimal configuration. It is the successor to [Nixpacks](https://nixpacks.com/) and incorporates several lessons learned from running Nixpacks in production at [Railway](https://railway.com/) over the years.
12+
13+
In Defang deployments, one of the most common points of failure is a missing or invalid Dockerfile that can’t produce OCI-compliant images. This is especially common when Dockerfile are generated by LLMs or created by users with limited Docker experience. Since integrating Railpack into Defang, if no Dockerfile is provided, we now automatically build a working image for you using Railpack.
14+
15+
## How to trigger a Defang Railpack deployment
16+
17+
When you run a Defang Railpack deployment you need 2 components:
18+
19+
A working application
20+
A valid compose file
21+
22+
Your compose file should not mention a Dockerfile.
23+
24+
For example,
25+
26+
```yaml
27+
services:
28+
app:
29+
restart: unless-stopped
30+
build:
31+
context: .
32+
deploy:
33+
resources:
34+
reservations:
35+
cpus: "1.0"
36+
memory: 512M
37+
ports:
38+
- mode: ingress
39+
target: 3000
40+
published: 3000
41+
```
42+
43+
## Troubleshooting and tips
44+
45+
If the deployment fails, here are some things you can try.
46+
47+
### Railpack Detection
48+
49+
To allow Railpack to generate a build plan for your project, please structure it to include the following files, or rename existing ones to be compatible.
50+
51+
#### Node
52+
53+
Your project will be detected as a Node.js application if a `package.json` file exists in the root directory.
54+
55+
Here is an example of a Railpack ready NextJS project.
56+
Here is an example of a Railpack ready React Vite project.
57+
58+
#### Python
59+
60+
Your project will be detected as a Python application if any of these conditions are met:
61+
62+
- A main.py file exists in the root directory (If your main.py is named anything else)
63+
- A requirements.txt file exists
64+
- A pyproject.toml file exists
65+
- A Pipfile exists
66+
67+
Here is an example of a Railpack ready Flask project.
68+
Here is an example of a Railpack ready Django project.
69+
70+
#### Go
71+
72+
Your project will be detected as a Go application if any of these conditions are met:
73+
74+
- A go.mod file exists in the root directory
75+
- A go.work file exists in the root directory (Go workspaces)
76+
- A main.go file exists in the root directory
77+
78+
Here is an example of a Railpack ready Golang project.
79+
80+
#### PHP
81+
82+
Your project will be detected as a PHP application if any of these conditions are met:
83+
84+
- An index.php file exists in the root directory
85+
- A composer.json file exists in the root directory
86+
87+
#### Java
88+
89+
Your project will be detected as a Java application if any of these conditions are met:
90+
91+
- A gradlew (Gradle wrapper) file exists in the root directory (to create this, if you don’t have one, run gradle wrapper)
92+
- A `pom.{xml,atom,clj,groovy,rb,scala,yaml,yml}` file exists in the root directory
93+
94+
#### Ruby
95+
96+
Your project will be detected as a Ruby application if any of these conditions are met:
97+
98+
- A Gemfile file is present
99+
100+
#### Rust
101+
102+
Your project will be detected as a Rust application if any of these conditions are met:
103+
104+
- A Cargo.toml file is present
105+
106+
#### Elixir
107+
108+
Your project will be detected as a Elixir application if any of these conditions are met:
109+
110+
- A mix.exs file exists in the root directory.
111+
112+
#### Static Sites
113+
114+
Railpack can automatically build and setup a server for static sites that require no build steps. The [Caddy](https://caddyserver.com/) server is used as the underlying web server.
115+
116+
Your project will be automatically detected as a static site if any of these conditions are met:
117+
118+
- A Staticfile configuration file exists in the root directory
119+
- An index.html file exists in the root directory
120+
- A public directory exists
121+
- The `RAILPACK_STATIC_FILE_ROOT` environment variable is set

0 commit comments

Comments
 (0)