mirror of
https://github.com/ziex-dev/ziex.git
synced 2026-07-21 02:59:36 -06:00
chore: merge branch 'main' into zig-0.17
This commit is contained in:
commit
6f78622f15
12
templates/.gitignore
vendored
12
templates/.gitignore
vendored
@ -60,6 +60,16 @@ node_modules/
|
||||
!node/package.json
|
||||
!node/README.md
|
||||
|
||||
# railway template
|
||||
!railway/railway.json
|
||||
!railway/README.md
|
||||
!railway/Dockerfile
|
||||
!railway/compose.yml
|
||||
!railway/.dockerignore
|
||||
|
||||
# render template
|
||||
!render/render.yaml
|
||||
!render/README.md
|
||||
!render/README.md
|
||||
!render/Dockerfile
|
||||
!render/compose.yml
|
||||
!render/.dockerignore
|
||||
82
templates/railway/README.md
Normal file
82
templates/railway/README.md
Normal file
@ -0,0 +1,82 @@
|
||||
# Ziex App on Railway
|
||||
|
||||
> A starter template for building web applications with [Ziex](https://ziex.dev) deployed on [Railway](https://railway.com/).
|
||||
|
||||
**[Documentation →](https://ziex.dev)**
|
||||
|
||||
[](https://railway.com/new/template?template=https://github.com/ziex-dev/template-railway)
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
**1. Install ZX CLI**
|
||||
|
||||
```bash
|
||||
# Linux/macOS
|
||||
curl -fsSL https://ziex.dev/install | bash
|
||||
|
||||
# Windows
|
||||
powershell -c "irm ziex.dev/install.ps1 | iex"
|
||||
```
|
||||
|
||||
**2. Install Zig**
|
||||
|
||||
```bash
|
||||
brew install zig # macOS
|
||||
winget install -e --id zig.zig # Windows
|
||||
```
|
||||
|
||||
[_Other platforms →_](https://ziglang.org/learn/getting-started/)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
├── app/
|
||||
│ ├── assets/ # Static assets (CSS, images, etc)
|
||||
│ ├── main.zig # Zig entrypoint
|
||||
│ ├── pages/ # Pages (Zig/ZX)
|
||||
│ │ ├── layout.zx # Root layout
|
||||
│ │ ├── page.zx # Home page
|
||||
│ │ ├── client.zx # Client-side component
|
||||
│ │ └── ...
|
||||
│ └── public/ # Public static files (favicon, etc)
|
||||
├── build.zig # Zig build script
|
||||
└── build.zig.zon # Zig package manager config
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
zig build dev
|
||||
```
|
||||
|
||||
App will be available at [`http://localhost:3000`](http://localhost:3000) with hot reload enabled.
|
||||
|
||||
## Deploy to Railway
|
||||
|
||||
### Via Railway Dashboard
|
||||
|
||||
1. Push this repo to GitHub
|
||||
2. Go to [Railway](https://railway.com/) and create a new project
|
||||
3. Select **Deploy from GitHub repo**
|
||||
4. In your service settings, configure:
|
||||
- **Build Command**: `zig build -Doptimize=ReleaseSafe && zig build zx -- bundle`
|
||||
- **Start Command**: `./bundle/ziex_app --rootdir ./bundle/static`
|
||||
|
||||
### Configuration
|
||||
|
||||
The app listens on port **3000** by default. In your Railway service settings, set the **Internal Port** to `3000`.
|
||||
|
||||
To use a custom port, add `-Dport=8080` to the build command and update the start command accordingly.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! For feature requests, bug reports, or questions, see the [Ziex Repo](https://github.com/ziex-dev/ziex).
|
||||
|
||||
## Links
|
||||
|
||||
- [Documentation](https://ziex.dev)
|
||||
- [Discord](https://ziex.dev/r/discord)
|
||||
- [Railway Docs](https://docs.railway.com/)
|
||||
- [Zig Language](https://ziglang.org/)
|
||||
19
templates/railway/railway.json
Normal file
19
templates/railway/railway.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"$schema": "https://railway.com/railway.schema.json",
|
||||
"build": {
|
||||
"builder": "DOCKERFILE",
|
||||
"dockerfilePath": "Dockerfile"
|
||||
},
|
||||
"deploy": {
|
||||
"healthcheckPath": "/",
|
||||
"healthcheckTimeout": 100,
|
||||
"restartPolicyType": "ON_FAILURE",
|
||||
"restartPolicyMaxRetries": 10
|
||||
},
|
||||
"variables": {
|
||||
"PORT": {
|
||||
"description": "Port the app listens on",
|
||||
"defaultValue": "3000"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,6 +102,19 @@ populate_template() {
|
||||
cp "$base_file" "$target_file"
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy _docker files (Dockerfile, compose.yml, .dockerignore)
|
||||
if [ -d "templates/_docker" ]; then
|
||||
find "templates/_docker" -type f | while read -r docker_file; do
|
||||
rel_path="${docker_file#templates/_docker/}"
|
||||
target_file="templates/$template/$rel_path"
|
||||
|
||||
if ! git check-ignore -q "$target_file"; then
|
||||
mkdir -p "$(dirname "$target_file")"
|
||||
sed -e 's/\$BIN_NAME/ziex_app/g' -e 's/\$PORT/3000/g' "$docker_file" > "$target_file"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
clean_template() {
|
||||
@ -120,9 +133,18 @@ clean_template() {
|
||||
fi
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
# Use git to list ignored files and remove them
|
||||
# Remove ignored files (populated from _base)
|
||||
# Note: we use -X to remove only ignored files, -d to remove directories if empty
|
||||
git clean -fdX "templates/$template/"
|
||||
|
||||
# Remove files that were copied from _base/_docker but are unignored
|
||||
for populated_file in .gitignore .gitattributes Dockerfile compose.yml .dockerignore; do
|
||||
local target_file="templates/$template/$populated_file"
|
||||
# Only remove if the file is not tracked by git (i.e., not committed)
|
||||
if [ -f "$target_file" ] && ! git ls-files --error-unmatch "$target_file" 2>/dev/null; then
|
||||
rm -f "$target_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
diff_template() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user