Skip to content

后端开发Strapi & Railway部署手册 #3

@Fankouzu

Description

@Fankouzu

后端开发Strapi & Railway部署手册

  • 本地命令行安装strapi
npx create-strapi-app@latest <my-project>
  • GitHub创建后端项目仓库,命名规则<项目名-backend>
  • 本地项目添加pg依赖
yarn add pg
  • 将本地仓库提交到GitHub
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/Booming3Labs/<仓库名>.git
git push -u origin main
  • Railway创建项目,导入GitHub仓库
  • Railway创建PostgresSQL
  • 拷贝PostgresSQL环境变量
DATABASE_CLIENT="postgres"
DATABASE_URL="postgresql://postgres:<password>@postgres.railway.internal:5432/railway"
DATABASE_HOST="postgres.railway.internal"
DATABASE_NAME="railway"
DATABASE_USERNAME="postgres"
DATABASE_PASSWORD="**********"
PORT="80"
HOST="0.0.0.0"
APP_KEYS=["",""]
API_TOKEN_SALT=""
ADMIN_JWT_SECRET=""
JWT_SECRET=""
  • 部署运行Strapi
  • 之后在本地运行Strapi创建表结构,查询逻辑
  • 提交到GitHub,Railway自动部署

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions