-
-
Notifications
You must be signed in to change notification settings - Fork 359
Deployment for self-hosting #2410
Comments
It's been a while, but I've created a template https://railway.app/template/it9kIn. Sorry for the delay, @allella, but it's ready for you test. The process is still quite involved, unfortunately. What you need to do is the following:
Depending on which email service you'd like to use, you need ( Configure Auth0Once this is done and you have your client URL, it should be added to your Auth0 application's Allowed Callback URLs, Allowed Logout URLs and Allowed Web Origins. Prepare the database# starting from the root of the repo
# install railway cli locally https://docs.railway.app/develop/cli
railway login
railway link
# connect to the server, not the client:
railway service
# install dependencies
npm i
# run the migration
railway run npm run prisma migrate deploy
# go to your site and login with the user you want to be an admin
railway run node server/prisma/seed/promoteToOwner.js And, finally, that's it. All being well, your chapter instance should be up and running. I know that's a lot, so please let me know if there's anything that needs to be clarified or doesn't work as expected. Hopefully it can be refined in time! |
Thanks. I'll work on running through these notes and hopefully in the next few days. |
@ojeytonwilliams I started deploying the Railway template and found it asking for more and more access to GitHub. This seems like too much. Is all of the following permissions really needed just to deploy an app on Railway? |
More specifically, why would it need access to All repositories? If I'm going to limit it, then would I select my fork of Chapter under "Only select repositories" ? If so, do I need to sync up with the upstream before deploying? |
Yes, that's correct. Since Railway asks for quite a lot of permissions, I only grant it access to specific repositories - the fork of Chapter in this case. And, yes, it would be a good idea to bring your fork up to date. |
Sorry, I didn't see added instructions earlier.
Second one should be dashboard -> Applications -> settings I think. I've followed instructions, but I'm getting both client and server builds failing. Before starting builds, I had to manually change Source Repo both for client and server (they were both In the build logs, errors start from Log
Then docker build fails Log
|
Ooops. I'd describe it as dashboard -> Applications -> your-application -> Settings, but, yes, my instructions were wrong. Thanks, I'll update them! |
Okay, so the postInstall error just needs to be suppressed. It's only telling us that it cannot set up an upstream remote and we don't need that for deployment. As for the rest of the errors, it looks like the template doesn't include the custom build command. Instead it runs Since the client and server both rely on the /common directory, I can't simply set the root to be /client and /server respectively. Instead, you have to configure those commands separately. For the client service go to
Similarly for the server service
Monorepos are hard to deploy, to say the least. If we can migrate the server to NextJS, this whole thing should get a lot easier, but I'm not sure that's realistic at the moment. |
That helped with the builds 🙆♂️. Although that either went awry, or database need to be additionally initialized for the server. Adding Couple notes:
|
Hey @gikf, sorry for the delay getting back to you. I need to take a little time off, but I should be back to 100% next week. |
@ojeytonwilliams No worries! |
@gikf #2607 adds a quick and dirty script to help setting up the db. I've also updated my instructions with a quick guide to that.
Well, it's always possible to
Do you remember which URLs you were copying?
I've added a little section about configuring Auth0, but, ultimately, people will need to check Auth0's docs (Chapter doesn't require anything non-standard, to my knowledge). |
Seeding db via the railway cli does the job. Everything worked as intended with the following notes (to not forget about):
Not sure about push, but before the first deploy, modifying environment variables did not trigger it. After first deploy (triggered differently - ie. disconnect and connect repo) changing environment variables was triggering new deploy.
|
@ojeytonwilliams I got further along and am asked "Where should we clone this repo?" when clicking "Configure" on the "Deploy Chapter" pages. I left the default value "Chapter Client" and filled out all of the variables with the word "placeholder" and when it tries to deploy I got "Failed to Deploy" and then another "Oh No" error on the second attempt. When I restart the process on the template page it highlights the "repo name" as being a problem. Do I need to set this to match the name of my fork? allella/chapter **Second Error ** |
@allella it looks like the problem is that https://github.com/allella/Chapter-Client already exists. When I tried re-doing the process it would not let me re-use a fork. @gikf cheers, I've updated the instructions. I left the Auth0 instructions alone, though, because the live config uses the client url rather than |
@ojeytonwilliams yeah, it had an error on the first try, so I'm it may have created that repo but never made a deployable app. In any case, is the idea to have it creating yet another copy of the repo, as in https://github.com/allella/Chapter-Client, or should I be telling it to use my main chapter repo https://github.com/allella/chapter ? I purposely haven't read the Railway docs because I wanted to approach this as someone who's never used Railway and see if the instructions we're providing are sufficient to not have to understand their way of doing everything. |
Yep, that sounds right. And, yes, unfortunately it does mean creating a new fork. I think the idea with Templates is that they're for newcomers to get up and running quickly, so the assumption is that they won't already have the repo. It's a bit of an oversight. I'll update the instructions, anyway. One thing to note: you can always change the source repo after getting set up. EDIT: actually, it looks like they've just changed things today and now it's possible to deploy using an existing fork! |
Chapter should have at least one well documented (and hopefully inexpensive) way to deploy the site.
To that end, I'm going to try to deploy to https://railway.app/ and document the process.
The text was updated successfully, but these errors were encountered: