背景
尝试搭建个私有化的postman玩
视频版见B站 https://www.bilibili.com/video/BV1SDoBYrEjC
准备
一台虚拟机
一个域名
一个SMTP服务器:我用的是qq的,需要一个额外授权码当密码用
安装docker和docker-compose
略
准备环境配置
注:安全起见SMTP密码在视频发布后会失效
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
#-----------------------Backend Config------------------------------# # Prisma Config DATABASE_URL=postgresql://postgres:6fyVResuychxGH8e@pgsql-hoppscotch:5432/hoppscotch?connect_timeout=300 # or replace with your database URL # (Optional) By default, the AIO container (when in subpath access mode) exposes the endpoint on port 80. Use this setting to specify a different port if needed. HOPP_AIO_ALTERNATE_PORT=80 # Auth Tokens Config JWT_SECRET=hVhdksivV6VNkF0H5TwSqJwyaV5llwO2 TOKEN_SALT_COMPLEXITY=10 MAGIC_LINK_TOKEN_VALIDITY=3 # Default validity is 7 days (604800000 ms) in ms REFRESH_TOKEN_VALIDITY=604800000 # Default validity is 1 day (86400000 ms) in ms ACCESS_TOKEN_VALIDITY=86400000 SESSION_SECRET=MaQSjhcPlUTNsxjDNbJrggkpirL2OHiq # Recommended to be true, set to false if you are using http # Note: Some auth providers may not support http requests ALLOW_SECURE_COOKIES=false # Sensitive Data Encryption Key while storing in Database (32 character) DATA_ENCRYPTION_KEY=wmaVSie5FpRj89yTlHx70jQN7iIZ7M4F # Hoppscotch App Domain Config REDIRECT_URL=http://postwoman.hylstudio.local # Whitelisted origins for the Hoppscotch App. # This list controls which origins can interact with the app through cross-origin comms. # - localhost ports (3170, 3000, 3100): app, backend, development servers and services # - app://localhost_3200: Bundle server origin identifier # NOTE: `3200` here refers to the bundle server (port 3200) that provides the bundles, # NOT where the app runs. The app itself uses the `app://` protocol with dynamic # bundle names like `app://{bundle-name}/` WHITELISTED_ORIGINS=http://postwoman.hylstudio.local:3170,http://postwoman.hylstudio.local:3000,http://postwoman.hylstudio.local:3100,app://localhost_3200,app://hoppscotch # VITE_ALLOWED_AUTH_PROVIDERS=GOOGLE,GITHUB,MICROSOFT,EMAIL VITE_ALLOWED_AUTH_PROVIDERS=EMAIL # Google Auth Config GOOGLE_CLIENT_ID=************************************************ GOOGLE_CLIENT_SECRET=************************************************ GOOGLE_CALLBACK_URL=http://localhost:3170/backend/v1/auth/google/callback GOOGLE_SCOPE=email,profile # Github Auth Config GITHUB_CLIENT_ID=************************************************ GITHUB_CLIENT_SECRET=************************************************ GITHUB_CALLBACK_URL=http://localhost:3170/backend/v1/auth/github/callback GITHUB_SCOPE=user:email # Microsoft Auth Config MICROSOFT_CLIENT_ID=************************************************ MICROSOFT_CLIENT_SECRET=************************************************ MICROSOFT_CALLBACK_URL=http://localhost:3170/backend/v1/auth/microsoft/callback MICROSOFT_SCOPE=user.read MICROSOFT_TENANT=common # Mailer config MAILER_SMTP_ENABLE=true MAILER_USE_CUSTOM_CONFIGS=false MAILER_ADDRESS_FROM=master@hylstudio.cn MAILER_SMTP_URL=smtps://956237586:mvzippsgybukbfgi@smtp.qq.com # used if custom mailer configs is false # The following are used if custom mailer configs is true MAILER_SMTP_HOST=smtp.domain.com MAILER_SMTP_PORT=587 MAILER_SMTP_SECURE=true MAILER_SMTP_USER=user@domain.com MAILER_SMTP_PASSWORD=pass MAILER_TLS_REJECT_UNAUTHORIZED=true # Rate Limit Config RATE_LIMIT_TTL=60 # In seconds RATE_LIMIT_MAX=100 # Max requests per IP #-----------------------Frontend Config------------------------------# # Base URLs VITE_BASE_URL=http://postwoman.hylstudio.local VITE_SHORTCODE_BASE_URL=http://postwoman.hylstudio.local/share VITE_ADMIN_URL=http://postwoman.hylstudio.local/admin # Backend URLs VITE_BACKEND_GQL_URL=http://postwoman.hylstudio.local/backend/graphql VITE_BACKEND_WS_URL=wss://postwoman.hylstudio.local/backend/graphql VITE_BACKEND_API_URL=http://postwoman.hylstudio.local/backend/v1 # Terms Of Service And Privacy Policy Links (Optional) VITE_APP_TOS_LINK=https://docs.hoppscotch.io/support/terms VITE_APP_PRIVACY_POLICY_LINK=https://docs.hoppscotch.io/support/privacy # Set to `true` for subpath based access ENABLE_SUBPATH_BASED_ACCESS=true |
准备compose文件
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
services: hoppscotch: image: registry.hylstudio.local/hoppscotch/hoppscotch container_name: hoppscotch env_file: - ./.env restart: always depends_on: - pgsql-hoppscotch ports: - "80:80" pgsql-hoppscotch: image: registry.hylstudio.local/postgres:17 container_name: pgsql-hoppscotch # This will be exposed at port 5432 ports: - "5432:5432" environment: # NOTE: Please UPDATE THIS PASSWORD! POSTGRES_DB: hoppscotch POSTGRES_USER: postgres POSTGRES_PASSWORD: 6fyVResuychxGH8e PGDATA: /var/lib/postgresql/data/pgdata volumes: - ./data:/var/lib/postgresql/data |
首次启动
0 1 |
docker compose up -d |
注意首次需要初始化一下数据库
0 1 2 |
docker compose run --entrypoint sh hoppscotch pnpm dlx prisma migrate deploy |
进入后台并试玩
从http://postwoman.hylstudio.local/admin登录完成首次设置后可用
todo
TODO 扩展一种本地的密码登录或CAS登录?
参考
https://docs.hoppscotch.io/documentation/self-host/getting-started
https://docs.hoppscotch.io/documentation/self-host/community-edition/install-and-build
0 Comments