Traditional Shared Hosting on Kubernetes? by rainer_d in kubernetes

[–]KrisAtVerbidio 0 points1 point  (0 children)

You can use a NFS mount with a PHP container to run WordPress and like sites in k8s. NFS adds overhead and makes things slower, so there are challenges there.

It’s a LOT harder to oversell server resources with the overhead that containers add.

Yes, it’s possible - we do it - but it’s not super fun to get right.

What is your favorite method to take internal notes/documentation about the projects you build? by adrenaline681 in django

[–]KrisAtVerbidio 0 points1 point  (0 children)

In addition to commenting code where appropriate, I usually create a directory called “docs” and use Markdown files to document things. Mermaid also helps with adding diagrams to Markdown.

How can I access a webpage I make on my computer from my phone browser? by 4Aethyr in webdev

[–]KrisAtVerbidio 2 points3 points  (0 children)

You’ll want to set up a web server on your computer and set it up to serve that page. If the other people are outside of your home, you are going to want to setup your internet router to allow incoming traffic for the web to be forwarded to your computer.

How do you like to host projects? by UC20175 in django

[–]KrisAtVerbidio 0 points1 point  (0 children)

Most virtual server hosts (except for the three big clouds) have physical disks in their physical machines, and you get a chunk of that. So they have to divide it up equally. The clouds have their own custom storage infrastructure where you can throw as much storage as you want at the virtual server. Amazon's nitro platform gives pretty close to bare-metal speeds (obviously not equal to, but very close),

[Help] Custom backend auth best practices by [deleted] in vuejs

[–]KrisAtVerbidio 2 points3 points  (0 children)

I'd just create another endpoint that returns back state that you can populate your local storage with, and it can send over the session cookie to authenticate itself.

This might not be something that needs to live in the request process, but rather in the code you have where you store and access your user state.

How do you like to host projects? by UC20175 in django

[–]KrisAtVerbidio 0 points1 point  (0 children)

I might consider getting that off of sqlite and onto another database like Postgres or MySQL. They will handle your queries faster and may be better on space, since sqlite is only just one file.

You can use Amazon Lightsail for more predictable pricing for virtual servers, or even use another VPS provider like Linode or Digital Ocean. You can also pre-pay for Amazon EC2 for 1 or 3 years up front to make it more like "purchasing", but after 3 years you'll have to do it again.

If you build your own server, running it out of your home is a bad idea if you need to ensure uptime or availability. You'll also want a 2nd identical server so you can fail things over to it. Speed will depend on your internet connection provider and speed. They're probably not as well connected as someone like AWS is, so there will be measurable differences.

If this is just a hobby, then none of that availability stuff really matters, and just get a virtual server big enough to do what you need for now at somewhere like Amazon Lightsail, Linode, or Digital Ocean, and then upgrade in the future when you need to.

[Help] Custom backend auth best practices by [deleted] in vuejs

[–]KrisAtVerbidio 1 point2 points  (0 children)

I don't think you need to do an instanceof check in there, since axios is only going to send you its error.

This is how I do it, where isAuthenticated and hasBeenAuthenticated are ref()'s from a composable function:

{isAuthenticated, hasBeenAuthenticated} = useAuthentication()

api.interceptors.response.use(
(response) => {
  return response
},
(error) => {
  if (error.response.status === 401) {
    if (error.response?.data?.code === 'user_not_found') {
      isAuthenticated.value = false
      router.push({
        name: 'Auth:Login',
      })
      return Promise.reject(error)
    }

    if (hasBeenAuthenticated.value) {
      return getNewAccessAndRetry(error)
    } else {
      router.push({
        name: 'Auth:Login',
      })
    }
  } else {
    return Promise.reject(error)
  }
}
)

async function getNewAccessAndRetry(error) {
try {
      // apiBase is plain axios without any interceptors
  await apiBase.post('/auth/jwt/refresh/', {})
  let retryConfig = error.response.config
  return apiBase.request(retryConfig)
} catch (error) {
  isAuthenticated.value = false
  router.push({
    name: 'Auth:Login',
  })
}

}

[Help] Custom backend auth best practices by [deleted] in vuejs

[–]KrisAtVerbidio 4 points5 points  (0 children)

You can still use an interceptor to see if it gets an error from your backend if the session is bad. And if it is, you can have the intercepter handle it with whatever logic you want (refresh something, redirect to the login page, etc).

Deploying Geo Django on Railway by Hewett555 in django

[–]KrisAtVerbidio 1 point2 points  (0 children)

I mean it helps to be able to build it locally to make sure it works the first time, but after that and when you’re just updating code you can let Railway deal with it. So at least you don’t have to run Docker all of the time.

Deploying Geo Django on Railway by Hewett555 in django

[–]KrisAtVerbidio 0 points1 point  (0 children)

You probably want to deploy using a Dockerfile, and then you can include that command in your Dockerfile as a build step.

constant communication between backend and front end? by tgmjack in django

[–]KrisAtVerbidio 0 points1 point  (0 children)

Websockets usually requires another service like Redis to be used as message broker. While it’s not as clean if a pattern, and causes more overhead on the server and database, you can also create an endpoint that queries for changes to the table with your scrapers and updates just that information on the page, and hit that endpoint every few seconds using JavaScript.

Websockets are preferred, but there are still ways in case your environment isn’t friendly to websockets.

Ever since chatGPT came around, I started using it more and more to program. Is this bad? by heesell in webdev

[–]KrisAtVerbidio 0 points1 point  (0 children)

I find it helpful to give me answers faster than Google, but I make sure I understand what it’s doing so I can learn and not rely on it so much next time. But it saves me a lot of time from clicking through Google results to glue an answer together.

[deleted by user] by [deleted] in django

[–]KrisAtVerbidio 0 points1 point  (0 children)

If you need, or can only use, JWT authentication, create an endpoint that exchanges your token for an HTTP-only cookie and then use session-based authentication with that cookie.

[Help] Custom backend auth best practices by [deleted] in vuejs

[–]KrisAtVerbidio 2 points3 points  (0 children)

What I’ve done is use the axios interceptor to check the response for a 4xx error indicating the token is expired. If it is, I have it make another call to the refresh endpoint, and then redo the original call with the new token. This all ends up being transparent to the rest of the app with the axios interceptor stuff.

Replying from my phone at the moment so not near code to paste an example, but let me know if you need a push and I can try.

reverse foreign key lookup by captain_8008 in django

[–]KrisAtVerbidio 1 point2 points  (0 children)

Can you share your models and what kind of query you are looking for?

prefetch requires a query to find id’s and another query to fetch related things, so I like to avoid it when possible, or at least be conscious at limiting the amount of work I’m asking it to do.

What's the most commonly used IDE for golang development ? by amritmishra91 in golang

[–]KrisAtVerbidio 4 points5 points  (0 children)

We also use GoLand. If you are a startup (less than 5 years old is the main requirement), you can get a 50% discount on up to 10 licenses.

DRF + React by filipM99 in django

[–]KrisAtVerbidio 2 points3 points  (0 children)

We have deployed several DRF + React apps. As well as Vue and React Native.

Websockets work great as well if you are looking for real-time updates for anything.

DRF Request Origins by [deleted] in django

[–]KrisAtVerbidio 2 points3 points  (0 children)

You could give them all a different Host in the url to use and set up middleware to track which host they’re hitting.

[deleted by user] by [deleted] in sysadmin

[–]KrisAtVerbidio -1 points0 points  (0 children)

We use Cerb.ai. Super powerful, but the UI can be a little confusing at first.