Skip to content

Commit a41cc4a

Browse files
committed
Railpack review
1 parent e326441 commit a41cc4a

File tree

1 file changed

+44
-19
lines changed

1 file changed

+44
-19
lines changed

docs/concepts/railpack.mdx renamed to docs/concepts/railpack.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ description: Defang will use Railpack to make an OCI-Compliant container image f
44
sidebar_position: 500
55
---
66

7-
8-
97
# Railpack
108

119
[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.
@@ -16,10 +14,10 @@ In Defang deployments, one of the most common points of failure is a missing or
1614

1715
When you run a Defang Railpack deployment you need 2 components:
1816

19-
A working application
20-
A valid compose file
17+
1. A working application
18+
2. A valid Compose file
2119

22-
Your compose file should not mention a Dockerfile.
20+
Your Compose file should not mention a Dockerfile.
2321

2422
For example,
2523

@@ -48,14 +46,16 @@ If the deployment fails, here are some things you can try.
4846
4947
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.
5048
51-
#### Node
49+
#### [Node](https://railpack.com/languages/node/)
5250
5351
Your project will be detected as a Node.js application if a `package.json` file exists in the root directory.
5452

55-
Here is an example of a Railpack ready NextJS project.
56-
Here is an example of a Railpack ready React Vite project.
53+
Here is an example of:
54+
55+
- A Railpack-ready [React Vite project](https://github.com/DefangLabs/samples/tree/main/samples/react-vite-railpack)
56+
- A Railpack-ready [NextJS project](https://github.com/DefangLabs/samples/tree/main/samples/nextjs-railpack)
5757

58-
#### Python
58+
#### [Python](https://railpack.com/languages/python)
5959

6060
Your project will be detected as a Python application if any of these conditions are met:
6161

@@ -64,52 +64,56 @@ Your project will be detected as a Python application if any of these conditions
6464
- A pyproject.toml file exists
6565
- A Pipfile exists
6666

67-
Here is an example of a Railpack ready Flask project.
68-
Here is an example of a Railpack ready Django project.
67+
Here is an example of:
6968

70-
#### Go
69+
- A Railpack-ready [Django project](https://github.com/DefangLabs/samples/tree/main/samples/django-railpack)
70+
- A Railpack-ready [Flask project](https://github.com/DefangLabs/samples/tree/main/samples/flask-railpack)
71+
72+
#### [Go](https://railpack.com/languages/golang)
7173

7274
Your project will be detected as a Go application if any of these conditions are met:
7375

7476
- A go.mod file exists in the root directory
7577
- A go.work file exists in the root directory (Go workspaces)
7678
- A main.go file exists in the root directory
7779

78-
Here is an example of a Railpack ready Golang project.
80+
Here is an example of:
81+
82+
- A Railpack-ready [Golang project](https://github.com/DefangLabs/samples/tree/main/samples/golang-http-form-railpack)
7983

80-
#### PHP
84+
#### [PHP](https://railpack.com/languages/php)
8185

8286
Your project will be detected as a PHP application if any of these conditions are met:
8387

8488
- An index.php file exists in the root directory
8589
- A composer.json file exists in the root directory
8690

87-
#### Java
91+
#### [Java](https://railpack.com/languages/java)
8892

8993
Your project will be detected as a Java application if any of these conditions are met:
9094

9195
- A gradlew (Gradle wrapper) file exists in the root directory (to create this, if you don’t have one, run gradle wrapper)
9296
- A `pom.{xml,atom,clj,groovy,rb,scala,yaml,yml}` file exists in the root directory
9397

94-
#### Ruby
98+
#### [Ruby](https://railpack.com/languages/ruby)
9599

96100
Your project will be detected as a Ruby application if any of these conditions are met:
97101

98102
- A Gemfile file is present
99103

100-
#### Rust
104+
#### [Rust](https://railpack.com/languages/rust)
101105

102106
Your project will be detected as a Rust application if any of these conditions are met:
103107

104108
- A Cargo.toml file is present
105109

106-
#### Elixir
110+
#### [Elixir](https://railpack.com/languages/elixir)
107111

108112
Your project will be detected as a Elixir application if any of these conditions are met:
109113

110114
- A mix.exs file exists in the root directory.
111115

112-
#### Static Sites
116+
#### [Static Sites](https://railpack.com/languages/staticfile)
113117

114118
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.
115119

@@ -119,3 +123,24 @@ Your project will be automatically detected as a static site if any of these con
119123
- An index.html file exists in the root directory
120124
- A public directory exists
121125
- The `RAILPACK_STATIC_FILE_ROOT` environment variable is set
126+
127+
Static sites are served using the Caddy web server and you need to have the environment variable `PORT` exposed like this in the Compose file to map to the correct port:
128+
129+
```
130+
services:
131+
app:
132+
restart: "unless-stopped"
133+
build:
134+
context: ./app
135+
# This is the port you need to add
136+
environment:
137+
PORT: 5173 # <--- PORT
138+
ports:
139+
- target: 5173
140+
published: 5173
141+
mode: ingress
142+
deploy:
143+
resources:
144+
reservations:
145+
memory: 512M
146+
```

0 commit comments

Comments
 (0)