• 1 Post
  • 13 Comments
Joined 1 year ago
cake
Cake day: June 24th, 2023

help-circle



  • Containers can be based on operating systems that are different to your computer.

    Containers utilise the host’s kernel - which is why there needs to be some hoops to run Linux container on Windows (VM/WSL).

    That’s one of the most key differences between VMs and containers. VMs virtualise all the hardware, so you can have a totally different guest and host operating systems; whereas because a container is using the host kernel, it must use the same kind of operating system and accesses the host’s hardware through the kernel.

    The big advantage of that approach, over VMs, is that containers are much more lightweight and performant because they don’t have a virtual kernel/hardware/etc. I find its best to think of them as a process wrapper, kind of like chroot for a specific application - you’re just giving the application you’re running a box to run in - but the host OS is still doing the heavy lifting.


  • As always, it depends! I’m a big fan of “the right tool for the job” and I work in many languages/platforms as the need arises.

    But for my “default” where I’m building up the largest codebase, I’ve gone for the following:

    • TypeScript
      • Strongly-typed (ish) which makes for a nice developer experience
      • Makes refactoring much easier/less error-prone.
      • Runs on back-end (node) and front-end, so only one language, tooling, codebase, etc. for both.
    • SvelteKit
      • Svelte as a front-end reactive framework is so nice and intuative to use, definite the best there is around atm.
      • It’s hybrid SSR/CSR is amazing, so nice to use.
      • As the back-end it’s “OK”, needs a lot more work IMO, but I do like it for a lot of things - and can not use it where necessary.
    • Socket.IO
      • For any real-time/stream based communication I use this over plain web sockets as it adds so much and is so easy to use.
    • PostgreSQL
      • Really solid database that I love more and more the more I use it (and I’ve used it a lot, for a very long time now!)
    • Docker
      • Easy to use container management system.
      • Everything is reproducible, which is great for development/testing/bug-fixing/and disasters.
      • Single method to manage all services on all servers, regardless of how they’re implemented.
    • Traefik
      • Reverse proxy that can be set to auto-configure based on configuration data in my docker compose files.
      • Automatically configuring takes a pain point out of deploying (and allows me to fully automate deployment).
      • Really fast, nice dashboard, lots of useful middleware.
    • Ubuntu
      • LTS releases keep things reliable.
      • Commercial support available if required.
      • Enough name recognition that when asked by clients, this reassures them.


  • I was recently helping someone working on a mini-project to do a bit of parsing of docker compose files, when I discovered that the docker compose spec is published as JSON Schema here.

    I converted that into TypeScript types using JSON Schema to TypeScript. So I can create docker compose config in code and then just export it as yaml - I have a build/deploy script that does this at the end.

    But now the great thing is that I can export/import that config, share it between projects, extend configs, mix-in, and so on. I’ve just started doing it and it’s been really nice so far, when I get a chance and it’s stabilised a bit I’m going to tidy it up and share it. But there’s not much I’ve added beyond the above at the moment (just some bits to mix-in arrays, which was what set me off on this whole thing!)






  • vampatori@feddit.uktoSelfhosted@lemmy.worldDefeated by NGINX
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    1 year ago

    Assume nothing! Test every little assumption and you’ll find the problem. Some things to get you started:

    • Does the “app” domain resolve to the app container’s IP from within the nginx container?
    • Can you proxy_pass to the host:port directly rather than using an upstream definition? If not, what about IP:port?
    • Can you connect to the app container from outside (if exposed)? What about from inside the nginx container? What about inside the app container?
    • Is the http(s) connection to the server (demo.example.com) actually going to your nginx instance? Shut it down and see if it changes.
    • If it works locally on 80, can you get it to work on the VPS on 80?
    • Are you using the exact same docker-compose.yaml file for this as locally? If not, what’s different?
    • Are you building the image? If so, are you incrementing the version number of the build so it gets updated?
    • Is there a firewall running on the host OS? If so, is it somehow interfering? Disable it and see.

    While not a direct solution to your problem, I no longer manually configure my reverse proxies at all now and use auto-configuring ones instead. The nginx-proxy image is great, along with it’s ACME companion image for automatic SSL cert generation with certbot - you’ll be up and running in under 30 mins. I used that for a long time and it was great.

    I’ve since moved to using Traefik as it’s more flexible and offers more features, but it’s a bit more involved to configure (simple, but the additional flexibility means everything requires more config).

    That way you just bring up your container and the reverse proxy pulls meta-data from it (e.g. host to map/certbot email) and off it goes.