TTC
Theo's Typesafe Culthaitam
How do you self host your projects in a vps
without relying on any cpanel or vercel,
i have a vps and i usually move the project using git and run yarn build then yarn start
i also sat up a systemd service that handles keeping that website running
so my process of upgrading the site would be to ssh into it and then run yarn build
but after some testing, i found out that while the build is running, i can't access the website, and or if the build fails the website breaks.
i saw something in the vercel cli where it builds it then if the build is successful it outputs it into "out" folder
then it runs it from there.
is there a way to do that without involving needing vercel
F
Finn•364d ago
have ci that builds a docker image and pushes that to a docker repository ( docker hub / github docker repo or somthing ) then when you want to deploy you restart the docker image on your vps with the new version.
H
haitam•364d ago
i haven't pushed to a docker repo before,
is it public?
P
pajaro•364d ago
doesn't have to be, pretty sure you have to pay for private ones on dockerhub but private ones are free on gitlab (not sure about github though)
M
Matvey•364d ago
Haven't tried this personally, but it looks promising - https://coolify.io/
H
haitam•364d ago
or i can just upload the docerfile in github
and build it in the server
F
Finn•364d ago
you could just put a docker file in your repo yeah
and then clone on your server, but that is more manual
H
haitam•364d ago
i already have ssh/git setup soo yeah
F
Finn•364d ago
still not recomened lol
but it works
B
barry•364d ago
@hhk Regarding the "run from a custom build folder", you can build a standalone folder which doesn't depend on a node modules folder or .next if that helps
Basically just gives you a folder with all the stuff and a server.js or something like that you can just run with node
P
PotatisMannen•364d ago
This sounds promising. Depending your restart time of your main server you could have a max downtime of a couple secs if your cluster is fast enough
H
haitam•364d ago
.nextjs folder doesn't have a server.js
H
haitam•364d ago
B
barry•364d ago
Didn't say it did
You have to tell nextjs to be in standalone mode
H
haitam•364d ago
a meeting came up. i will be active in few minutes
H
haitam•364d ago
do i need to copy just the standalone folder?
H
haitam•364d ago
thank you soo much for your help
H
haitam•364d ago
for anyone intrested i made these two scripts
NOTES:
- add
output: "standalone"
in the next.config,js
- make sure all your images are imported and not just in the public folder and being referenced
if you are referencing them to get the background image working in a div you can actually import it and instead of padding it directly, it has a property called src, which is what you need. ex:
- make sure you ignore the out file.
- if at any point your build fails and somehow lost s1 (in the out folder). you can copy what's on s2 into s1
s2 represents the last successful build.P
pajaro•364d ago
re: script #1, pretty much you can just
source .env
wrt script 2, you can use set -e
at the top to avoid having to use &&
on everything
(the script will exit if something fails,
if something can fail safely, you can use || true
to prevent this)
does the "renaming things into place" strategy work well?F
Finn•364d ago
Huh til
P
pajaro•364d ago
do you like..
&&
all the things?F
Finn•361d ago
nah the source on files like .env
😅
H
haitam•360d ago
interesting.. thanks for the tips
P
pajaro•360d ago
pretty sure*
bash is mostly tips and tricks
H
haitam•360d ago
terminal on steroids
21KMembers
View on DiscordWant results from more Discord servers?
More PostsGeniune question: php vs server componentsI love nextjs. I hear a lot of comments about nextjs just reinvented php. Can someone clarify thingsHow do you fetch an svg from s3 into an angular app?I tried several things, but each time the svg isn't displayed.What's this errorit was working till yesterday then i added stateDistrict to address model then i started to get thisPrisma find many undefinedHello,
In my other projet when i do `prisma.resource.findMany({select: ...})` the type is `{id: strESLint to force @types in dev-dependenciesWe recently had an outage coz someone installed the @types/[package-name] in dependencies, but neverUpdating existing T3 with Supabase Auth from Next AuthBackground:
- Launched a T3 app with Next Auth.
- Currently got 3000 users.
- Launching an app vetRPC + AppRouter without reactQueryhi everyone how can i host trpc on next.js and use trpc on server components without using react queMutate instantly returning success instead of isLoadingI have been working on this endpoint that uploads files do Google Drive. It can upload one or multipNext 13.4 problem with loading state after content is visible & hydration problemHey, I have a small app with Next 13.4 with Shadcn Ui 😍 it's really really good.
But I'm also usingis there a way to change/refresh token when data in db changes such as role?Hi, I had a project using NextAuth as my provider and the JWT strategy. When I use the database straRefresh a single React Server ComponetnsI have a dashboard where I want a certain piece of data to update every 10 seconds, what's the best Axios Singleton good or bad idea and how to implement?Hey ppl, I'm asking myself a question.
Is it a good idea to have a single instance of axios for an aNext-Auth in server rendered components aka appDir pageshow do we deal with next-auth in appDir? I am genuinely curious, as I am trying to migrate from pageAny Clerk gurus in here? Following the Next.js 13 getting started guide renders blank screenFollowing the getting started with nextjs guide for clerk renders a completely blank screen. I've foNested TRPC CallsHi, would anyone be able to assist please? Hope it's ok to post stack overflow link, just figured coCan I use tRPC with Next.Js App RouterI want to know if there's a way I can use tRPC with Next.Js app router. I mean, I don't want to use Suggestions for React Native offline-first DB with syncingHi all, basically I’m trying to get Firebase functionality without using Firebase. because of Their Querying external api in trpc router not workingHi guys! So I'm trying to query an api endpoint that I created through a separate node server insideinfer from trpc callsIt appears trpc clients dont infer the return type, and I have to set it in useQuery like this..
Using GithubAPI + NextAuth Github Provider to access a User's repo information.I am building an app where will allow users to login with Github and view their Github accounts data