-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Session/agent 5ee51bcf 331f 494c b320 fb172fd1c1a9 #2951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .git/ | ||
| .github/ | ||
| .idea/ | ||
| .DS_Store | ||
| build/ | ||
| dist/ | ||
| *.db | ||
| *.bin | ||
| *.test | ||
| *.out | ||
| /tmp/ | ||
| /log/ | ||
| /lang/ | ||
| /daemon/ | ||
| /public/dist/* | ||
| !/public/dist/README.md | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .git/ | ||
| .github/ | ||
| .idea/ | ||
| .DS_Store | ||
| build/ | ||
| dist/ | ||
| *.db | ||
| *.bin | ||
| *.test | ||
| *.out | ||
| /tmp/ | ||
| /log/ | ||
| /lang/ | ||
| /daemon/ | ||
| /public/dist/* | ||
| !/public/dist/README.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| FROM alpine:edge AS builder | ||
| LABEL stage=go-builder | ||
| WORKDIR /app/ | ||
| RUN apk add --no-cache bash curl jq gcc git go musl-dev | ||
| COPY go.mod go.sum ./ | ||
| RUN go mod download | ||
| COPY ./ ./ | ||
| RUN bash build.sh release docker | ||
|
|
||
| FROM alpine:edge | ||
| LABEL MAINTAINER="OpenList" | ||
| ARG INSTALL_FFMPEG=false | ||
| ARG INSTALL_ARIA2=false | ||
| ARG USER=openlist | ||
| ARG UID=1001 | ||
| ARG GID=1001 | ||
|
|
||
| WORKDIR /opt/openlist/ | ||
|
|
||
| RUN addgroup -g ${GID} ${USER} && \ | ||
| adduser -D -u ${UID} -G ${USER} ${USER} && \ | ||
| mkdir -p /opt/openlist/data && \ | ||
|
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The directory is created by root with the default Useful? React with 👍 / 👎. |
||
| apk add --no-cache ca-certificates tzdata && \ | ||
| if [ "${INSTALL_FFMPEG}" = "true" ]; then apk add --no-cache ffmpeg; fi && \ | ||
| if [ "${INSTALL_ARIA2}" = "true" ]; then apk add --no-cache aria2; fi | ||
|
|
||
| COPY --from=builder --chmod=755 --chown=${UID}:${GID} /app/bin/openlist ./ | ||
| COPY --chmod=755 --chown=${UID}:${GID} entrypoint.sh /entrypoint.sh | ||
|
|
||
| USER ${USER} | ||
| RUN /entrypoint.sh version | ||
|
|
||
| ENV UMASK=022 RUN_ARIA2=${INSTALL_ARIA2} | ||
| VOLUME /opt/openlist/data/ | ||
| EXPOSE 5244 5245 | ||
| CMD [ "/entrypoint.sh" ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| # Railway Deployment Guide | ||
|
|
||
| Deploy OpenList on Railway with persistent storage and automatic HTTPS. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - A [Railway](https://railway.app) account | ||
| - This repository connected to Railway (or a new project from this repo) | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### 1. Create a New Project | ||
|
|
||
| 1. Go to [Railway Dashboard](https://railway.app/dashboard) | ||
| 2. Click **"New Project"** | ||
| 3. Select **"Deploy from GitHub repo"** (or upload this repo) | ||
| 4. Choose this repository | ||
|
|
||
| ### 2. Railway will Auto-Detect | ||
|
|
||
| Railway will automatically detect the `railway.json` or `railway.toml` in the repo root and use `Dockerfile.railway` for building. | ||
|
|
||
| ### 3. Add a Volume (Persistent Storage) | ||
|
|
||
| OpenList stores data (database, uploads, configs) in `/opt/openlist/data`. You need a persistent volume: | ||
|
|
||
| 1. In your Railway project, click **"New"** → **"Volume"** | ||
| 2. Name it `openlist-data` | ||
| 3. Mount it to `/opt/openlist/data` in your service | ||
|
|
||
| ### 4. Configure Environment Variables | ||
|
|
||
| Go to your service → **Variables** tab and add: | ||
|
|
||
| | Variable | Value | Description | | ||
| |----------|-------|-------------| | ||
| | `UMASK` | `022` | File permissions mask | | ||
| | `TZ` | `Asia/Shanghai` | Timezone (optional) | | ||
| | `RUN_ARIA2` | `false` | Enable aria2 (optional, increases build time) | | ||
| | `INSTALL_FFMPEG` | `false` | Install ffmpeg (optional, increases build time) | | ||
| | `INSTALL_ARIA2` | `false` | Install aria2 (optional, increases build time) | | ||
| | `GITHUB_TOKEN` | `<your_token>` | GitHub token to avoid API rate limits when downloading the frontend (optional) | | ||
|
|
||
| > **Note:** Railway's dynamic `PORT` is automatically mapped to `HTTP_PORT` by the entrypoint script. You do **not** need to manually set `HTTP_PORT=$PORT`. | ||
|
|
||
| ### 5. Deploy | ||
|
|
||
| 1. Railway will automatically build and deploy | ||
| 2. Wait for the build to complete (first build takes ~3-5 minutes) | ||
| 3. Check the **Deployments** tab for build logs | ||
|
|
||
| ### 6. Get Admin Credentials | ||
|
|
||
| On first startup, OpenList generates a random admin password. Find it in the deployment logs: | ||
|
|
||
| 1. Go to **Deployments** → click on the latest deployment | ||
| 2. View **Logs** | ||
| 3. Look for: `Successfully created the admin user and the initial password is: XXXXXXXX` | ||
|
|
||
| Alternatively, you can set a fixed admin password by running: | ||
| ``` | ||
| openlist admin set YOUR_PASSWORD | ||
| ``` | ||
|
|
||
| ### 7. Access OpenList | ||
|
|
||
| Once deployed, Railway will provide a public URL like: | ||
| ``` | ||
| https://your-project.up.railway.app | ||
| ``` | ||
|
|
||
| Open this URL in your browser and log in with the admin credentials. | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Database | ||
|
|
||
| By default, OpenList uses SQLite and stores the database in the volume at `/opt/openlist/data/data.db`. | ||
|
|
||
| For better performance, you can use Railway's PostgreSQL: | ||
|
|
||
| 1. Add a **PostgreSQL** database to your Railway project | ||
| 2. Set these environment variables: | ||
| - `DB_TYPE=postgresql` | ||
| - `DB_HOST=${{Postgres.HOSTNAME}}` | ||
| - `DB_PORT=${{Postgres.PORT}}` | ||
| - `DB_USER=${{Postgres.USERNAME}}` | ||
| - `DB_PASS=${{Postgres.PASSWORD}}` | ||
| - `DB_NAME=${{Postgres.DATABASE}}` | ||
|
|
||
| ### Custom Domain | ||
|
|
||
| 1. Go to **Settings** → **Domains** | ||
| 2. Add your custom domain | ||
| 3. Railway will automatically provision an SSL certificate | ||
|
|
||
| ### Build Options | ||
|
|
||
| Edit `railway.json` or `railway.toml` to customize: | ||
|
|
||
| - `restartPolicyType`: `"on-failure"` or `"always"` | ||
| - `healthcheckPath`: Health check endpoint | ||
| - `INSTALL_FFMPEG`: Set to `true` to enable ffmpeg | ||
| - `INSTALL_ARIA2`: Set to `true` to enable aria2 | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Build Fails | ||
|
|
||
| - Check build logs for missing dependencies | ||
| - Ensure `go.mod` and `go.sum` are present | ||
| - Try rebuilding with `INSTALL_FFMPEG=false` and `INSTALL_ARIA2=false` | ||
| - If the build fails while downloading the frontend, add a `GITHUB_TOKEN` variable with a GitHub personal access token to avoid API rate limits | ||
| - As a fallback, you can change `bash build.sh release docker` to `bash build.sh dev docker` in `Dockerfile.railway` to skip frontend version pinning | ||
|
|
||
| ### Port Not Accessible | ||
|
|
||
| - The entrypoint automatically maps Railway's `PORT` to `HTTP_PORT` | ||
| - Check that the service is listening on `0.0.0.0` (default) | ||
| - Ensure no other process is using the assigned port | ||
|
|
||
| ### Data Lost After Redeploy | ||
|
|
||
| - Ensure the volume is mounted to `/opt/openlist/data` | ||
| - Check volume status in Railway dashboard | ||
|
|
||
| ### Cannot Login | ||
|
|
||
| - Check deployment logs for admin password | ||
| - Ensure database file exists in volume | ||
|
|
||
| ## Manual Railway CLI Deployment | ||
|
|
||
| If you prefer using the Railway CLI: | ||
|
|
||
| ```bash | ||
| # Install Railway CLI | ||
| npm i -g @railway/cli | ||
|
|
||
| # Login | ||
| railway login | ||
|
|
||
| # Initialize project | ||
| railway init | ||
|
|
||
| # Link to existing project | ||
| railway link | ||
|
|
||
| # Deploy | ||
| railway up | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| Railway Project | ||
| ├── Service: OpenList | ||
| │ ├── Build: Dockerfile.railway | ||
| │ ├── Port: $PORT (mapped to HTTP_PORT) | ||
| │ └── Volume: /opt/openlist/data | ||
| └── (Optional) PostgreSQL Database | ||
| ``` | ||
|
|
||
| ## Files Added | ||
|
|
||
| - `railway.json` - Railway project configuration | ||
| - `railway.toml` - Alternative Railway configuration | ||
| - `Dockerfile.railway` - Self-contained Dockerfile for Railway | ||
| - `.railwayignore` - Files excluded from Railway builds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing
.gitfrom the build context makes bothDockerfileandDockerfile.railwayfail atRUN bash build.sh release docker:build.shruns underset -eand line 5 unconditionally executesgitCommit=$(git log ... -1), which exits 128 when the copied source has no.gitdirectory. Preserve the metadata or make the build script tolerate its absence.Useful? React with 👍 / 👎.