| 1 | import { |
| 2 | bucket, |
| 3 | defineRailway, |
| 4 | github, |
| 5 | image, |
| 6 | postgres, |
| 7 | preserve, |
| 8 | project, |
| 9 | service, |
| 10 | volume, |
| 11 | } from "railway/iac"; |
| 12 | |
| 13 | export default defineRailway(() |
| 14 | const ghost = |
| 15 | |
| 16 | const postgresDatabase = |
| 17 | region: "asia-southeast1-eqsg3a", |
| 18 | }); |
| 19 | postgresDatabase.networking = |
| 20 | const postgresVolumeUO8m = |
| 21 | alerts: { usage: { |
| 22 | allowOnlineResize: true, |
| 23 | region: "asia-southeast1-eqsg3a", |
| 24 | sizeMB: 5000, |
| 25 | }); |
| 26 | const ghostBucket = |
| 27 | const web = |
| 28 | source: ghost, |
| 29 | build: { |
| 30 | buildEnvironment: "V3", |
| 31 | builder: "DOCKERFILE", |
| 32 | dockerfilePath: "/apps/web/Dockerfile", |
| 33 | watchPatterns: ["/apps/web/**"], |
| 34 | }, |
| 35 | replicas: { "asia-southeast1-eqsg3a": |
| 36 | deploy: { sleepApplication: true |
| 37 | domains: ["web.ghost.procrastinator.fyi"], |
| 38 | env: { |
| 39 | NEXT_PUBLIC_API_URL: preserve(), |
| 40 | NEXT_PUBLIC_DOCS_URL: preserve(), |
| 41 | NEXT_PUBLIC_SITE_URL: preserve(), |
| 42 | OTEL_EXPORTER_OTLP_ENDPOINT: preserve(), |
| 43 | }, |
| 44 | }); |
| 45 | const docs = |
| 46 | source: ghost, |
| 47 | build: { |
| 48 | buildEnvironment: "V3", |
| 49 | builder: "DOCKERFILE", |
| 50 | dockerfilePath: "/apps/docs/Dockerfile", |
| 51 | watchPatterns: ["/apps/docs/**"], |
| 52 | }, |
| 53 | replicas: { "asia-southeast1-eqsg3a": |
| 54 | deploy: { sleepApplication: true |
| 55 | domains: ["docs.ghost.procrastinator.fyi"], |
| 56 | env: { |
| 57 | NEXT_PUBLIC_DOCS_URL: preserve(), |
| 58 | NEXT_PUBLIC_WEB_APP_URL: preserve(), |
| 59 | }, |
| 60 | }); |
| 61 | const api = |
| 62 | source: ghost, |
| 63 | build: { |
| 64 | buildEnvironment: "V3", |
| 65 | builder: "DOCKERFILE", |
| 66 | dockerfilePath: "apps/api/Dockerfile", |
| 67 | watchPatterns: ["/apps/api/**"], |
| 68 | }, |
| 69 | healthcheck: "/api", |
| 70 | healthcheckTimeout: 60, |
| 71 | preDeploy: "node packages/db/dist/migrate.js", |
| 72 | replicas: { "asia-southeast1-eqsg3a": |
| 73 | deploy: { restartPolicyMaxRetries: 5 |
| 74 | domains: ["api.ghost.procrastinator.fyi"], |
| 75 | env: { |
| 76 | AUTH_COOKIE_DOMAIN: preserve(), |
| 77 | AUTH_TRUSTED_ORIGINS: preserve(), |
| 78 | BETTER_AUTH_SECRET: preserve(), |
| 79 | BETTER_AUTH_URL: preserve(), |
| 80 | DATABASE_URL: preserve(), |
| 81 | EMAIL_PROXY: preserve(), |
| 82 | EMAIL_PROXY_SECRET: preserve(), |
| 83 | EMAIL_SENDER: preserve(), |
| 84 | EMAIL_VERIFICATION_ENABLED: preserve(), |
| 85 | S3_ACCESS_KEY_ID: preserve(), |
| 86 | S3_BUCKET: preserve(), |
| 87 | S3_ENDPOINT: preserve(), |
| 88 | S3_SECRET_ACCESS_KEY: preserve(), |
| 89 | WEB_APP_URL: preserve(), |
| 90 | }, |
| 91 | }); |
| 92 | const otelLgtm = |
| 93 | source: image("grafana/otel-lgtm |
| 94 | replicas: { "asia-southeast1-eqsg3a": |
| 95 | deploy: { sleepApplication: true |
| 96 | env: { |
| 97 | GF_SECURITY_ADMIN_PASSWORD: preserve(), |
| 98 | GF_SECURITY_ADMIN_USER: preserve(), |
| 99 | }, |
| 100 | }); |
| 101 | |
| 102 | return project("Ghost |
| 103 | resources: [ |
| 104 | web, |
| 105 | docs, |
| 106 | api, |
| 107 | postgresDatabase, |
| 108 | otelLgtm, |
| 109 | postgresVolumeUO8m, |
| 110 | ghostBucket, |
| 111 | ], |
| 112 | }); |
| 113 | }); |