2 years ago
Description: A privacy-focused, ready-to-use alternative for Notion & Miro
Category: Other
26 Replies
2 years ago
Hey, just some feedback -
Your template is missing a volume, without that the blob storage won't persist between deployments.
You are using the public database URL instead of the private URL, this would subject template users to avoidable egress fees.
For the
AFFINE_ADMIN_PASSWORDvariable, you can have Railway generate a password by setting the field to${{secret(32)}}The AFFiNE service is missing a health check
The overview is looking a little bleak if I'm honest
2 years ago
Hi! Thanks for the feedback. I'm very new here and this will definitely help me improve, on my first template
2 years ago
I'm more than happy to go into more details on anything if you need me to, ask away!!
2 years ago
That's very nice! I was about to ask you if you could please review it again. I tried to fixed the points, but I'm not sure of course…
2 years ago
Additional feedback -
The health check should not include the domain, That field doesn't support reference variables either, just the path is all that's needed.
The
DATABASE_URLvariable has a typo.For the template and service icon you use "https://affine.pro/_nuxt/stable.a3dfec60.png" This would not be ideal as it appears to be a hashed file and would likely disappear the next time AFFiNE deploys their website.
The AFFiNE service does not come with a domain.
The template service is missing an
AFFINE_PRIVATE_KEYvariable.
2 years ago
I don't understand "The AFFiNE service does not come with a domain." can you explain me a bit please ? 🙏
2 years ago
My bad, I was wrong on that, the JSON config for your template that I was looking at was a bit confusing in that regard, you do indeed have a domain on that service.
Attachments
2 years ago
Oh woow! Good catch on the AFFINE_PRIVATE_KEY. Do you know if there is a way to generate it, like the password trick with secret(32) ?
2 years ago
You would use the same syntax ${{secret(32)}}
Though I'm not sure of the length it wants, that's something that would have to be looked into.
2 years ago
I think it's fine actually. The self hosted version generates it internally. I'm going to check that.
Attachments
2 years ago
I know, but always better to have it set as a service variable if possible so that it's not regenerating itself every deployment, thus causing something like sessions to become invalided.
2 years ago
Well thought 👍 I'm gonna need to check more in detail how to do this. Indeed, the private key should ideally be persisted. I'll check also Railway documentation to see if there is an easy way to debug locally the templates
2 years ago
Alright, I checked it and it's fine! The private key is stored in a .env that is on a volume in /root/.affine/config, so it's persisted across launches! I really thank you for your help, it's so great to have some nice support like this for a beginner like me 🙏 Going on n8n.
Attachments
2 years ago
You can only mount one volume to one service and you are mounting that volume to /root/.affine/storage so anything in /root/.affine/config will not be persisted.
2 years ago
I see. I'm learning so much thanks to you! I'll simply move AFFINE_CONFIG_PATH to /root/.affine/storage, WDYT ?
2 years ago
That's a good idea, but I would set AFFINE_CONFIG_PATH to /root/.affine/storage/config
2 years ago
I thought about it too, but I was afraid it would not mkdir the subpath. Thanks, let's do this!
2 years ago
Mounting a volume does indeed create the directory path within the container.
2 years ago
Not sure if this template was ever completed but I get the attached result when deploying. It just so happens that I picked on Affine to test Railway, other service deployments have been fine.
Looks like a custom compose.yml is required to move the config storage, AFFINE_CONFIG_PATH isn't respected.
https://docs.affine.pro/docs/self-host-affine/run-affine-with-custom-options
Attachments
2 years ago
This template doesn't work for me, I am getting the attached error. And I wonder if the template should include a Redis module, isn't it a requisite?
Attachments
2 years ago
I'm getting this error:
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/2e285b77-fbfd-44a3-8bfd-6d92c4b0ad29/vol_1ma7tek4f4pqazg0
error TS5083: Cannot read file '/tsconfig.json'.
(node:1) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use node --trace-warnings ... to show where the warning was created)
node:fs:1640
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat '/root/.affine/storage/config/affine.env.js'
at lstatSync (node:fs:1640:25)
at getStatsSync (node:internal/fs/cp/cp-sync:120:19)
at checkPathsSync (node:internal/fs/cp/cp-sync:72:33)
at cpSyncFn (node:internal/fs/cp/cp-sync:58:42)
at cpSync (node:fs:3077:3)
at loadRemote (file:///app/dist/prelude.js:12:9)
at load (file:///app/dist/prelude.js:36:11)
at file:///app/dist/prelude.js:47:7 {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '/root/.affine/storage/config/affine.env.js'
}
Node.js v20.15.1
2 years ago
I'm getting this error:
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/2e285b77-fbfd-44a3-8bfd-6d92c4b0ad29/vol_1ma7tek4f4pqazg0error TS5083: Cannot read file '/tsconfig.json'.
(node:1) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use
node --trace-warnings ...to show where the warning was created)node:fs:1640
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat '/root/.affine/storage/config/affine.env.js'
at lstatSync (node:fs:1640:25)
at getStatsSync (node:internal/fs/cp/cp-sync:120:19)
at checkPathsSync (node:internal/fs/cp/cp-sync:72:33)
at cpSyncFn (node:internal/fs/cp/cp-sync:58:42)
at cpSync (node:fs:3077:3)
at loadRemote (file:///app/dist/prelude.js:12:9)
at load (file:///app/dist/prelude.js:36:11)
at file:///app/dist/prelude.js:47:7 {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '/root/.affine/storage/config/affine.env.js'
}
Node.js v20.15.1
https://railway.app/template/V4HyAi I created a new template, hope it helps.
2 years ago
Alright, it's been a while and I didn't maintain it. There is no point of having multiple templates of the same thing. If yours is up to date and working, do you think I can delete this one @alanvww ?