• 2 Posts
  • 24 Comments
Joined 1 year ago
cake
Cake day: June 24th, 2023

help-circle




  • 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!)




  • There’s more! Well, it’s more a bash thing than a cd thing… in bash the variable $_ refers to the last argument to the previous command. So you can do the following:

    > mkdir -p my/nested/dir
    > cd $_
    > pwd
    /home/user/my/nested/dir
    

    It’s handy for a whole host of things, like piping/touching then opening a file, chown then chmod, etc.




  • I’m new to it too, I’ve known about its existence but have been thinking about adding support for it to a project I’m starting soon - really to learn more about it (I tend to learn best by doing!)

    It’s goal is for each of us to have personal ownership of all our data online, and full control over who can access what. That’s certainly something I can get behind! You do this by creating a “pod”, which is essentially a database of all your data (I think organised into groups, e.g. each organisation can have their own group of data), which you can self-host if you like, along with the ability to control access.

    It’s current impact I would say is near zero. But TBL is a person with a reasonable amount of pull, and he’s setup his own company providing commercial services (presumably, consulting). My guess is they’re dealing with governments and mega-corps - there seems to be very little effort pushing it to “the masses” (i.e. application developers).

    The theory sounds interesting but the practicalities of it seem to offer a lot of challenges, so I think the best way to get a real sense of whether it has legs or not is to build something!





  • 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.