I usually connect with my server via ssh in a terminal and run basic commands. What’s a better, more efficient and modern way of doing that? Especially considering ai and documentation along the way? I wonder if there’s a better approach than “connect from remote and act local”. Is there a method to “code local and push to remote”?

I use a fedora server with podman, caddyfile and vi.

  • GreenShimada@lemmy.world
    link
    fedilink
    English
    arrow-up
    45
    ·
    1 month ago

    I wait for something to break. Then I yell “God fucking dammit, I don’t have time for this right now!” and spend an hour triaging things before I just try docker down, pull, up and everything works.

      • rowinxavier@lemmy.world
        link
        fedilink
        English
        arrow-up
        9
        ·
        1 month ago

        Early on I wrote a script for my user account to run df and save the output to a file, then a second script to read that file and if the drive was full send me an email.

        First, it failed because it couldn’t send the email because the email service failed under full disk conditions.

        Second, it failed because it couldn’t write the file to disk because the disk was full.

        Third, it failed because outbound SMTP was blocked by my ISP.

        I learned a lot about how well you can fail if you really put your mind to it. Now I have Home Assistant grabbing the disk stats for my machines and flagging anything over 90%.

  • vext01@feddit.uk
    link
    fedilink
    English
    arrow-up
    24
    ·
    1 month ago

    I just use ssh and manually type commands. Keep doing it and you will get good and it will become second nature.

    No need to burn tokens on basic tasks.

    Master your tools. Learn awk, sed, just, etc.

    Some shell customisation can help. For example I’m fond of zsh-auto-suggestions and skim. Makes me quicker.

  • kossa@feddit.org
    link
    fedilink
    English
    arrow-up
    17
    ·
    1 month ago

    Ansible is one way to “code local, push to remote(s)”. Can define so-called playbooks, which is basically just a script, to do reoccuring tasks like e.g. updates.

    • ElectricVocalist@jlai.lu
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 month ago

      Ansible is great, I just wish it would automatically cleanup stuff on the server when I remove parts of the config. I know it’s not the goal, but I dream about a tool that works this way. I get many leftover stuff over years

  • soyslurper2@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    9
    ·
    1 month ago

    “code local and push remote” is only more efficient if you have a faulty connection with ssh or want to use a GUI editor that doesn’t support remote connections. What you’re doing is good. You can scoure for more “modern” ways that might have more glimmer and sparkly lights, but it won’t improve efficiency.

    • hirihit640@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      Declarative configuration (like docker compose) is basically “code local, push remote”, and it has a lot of benefits, including improving efficiency because you have a clearer idea of exactly what is set up on the server, to make it easier to debug or make changes.

      Contrast this with just sshing in and running a bunch of commands to install something. Then coming back months later and wondering “what files did I touch? what packagea did I install? Hmm dpkg log says I added X but then later I removed it, so was it important?” Etc.

  • dihutenosa@piefed.social
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 month ago

    I write my NixOS configs in my PC, commit to the repo, then push it to the server. Then SSH in, and apply it. Or more likely, MOSH in.

    • varyingExpertise@feddit.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 month ago

      That, and there is no change that isn’t done on ansible, or, when it required trying and research gets backported into a bit of ansible.

  • WolfLink@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 month ago

    It’s good to get comfortable in the command line, including over ssh.

    Especially considering ai and documentation along the way?

    If I am going to ask AI or Google about something, I just do that to help me find the answer and then apply the answer myself. That way I learn, and can double check the AI isn’t hallucinating, at least on in obvious ways.

    As for documentation, I keep a notes folder with detailed notes on manual configuration I’ve done, how and why, and the things I’ve learned along the way. I’ve found it’s both useful to help remember the things I’ve learned, and it is useful to go back to refer to.

  • idunnololz@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 month ago

    I ssh into it twice a year to perform updates but otherwise i leave it alone. Server’s been chugging along for like a decade now.

  • Nibodhika@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 month ago

    I spent a while getting Ansible to be able to setup and maintain my server(s). And ended up not using it as much as I should, mostly because the computer I used to run Ansible from became a “Steam Machine” so I’m rarely sitting on it with a keyboard now and I don’t want to have personal info and keys on my work computer.

    But it was a good learning, and useful while I used it. Now I just use ssh and compose files directly.

    • corsicanguppy@lemmy.ca
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      You upgraded from ansible to ssh. As someone forced to write yaml for ansible professionally and has used many other config management tools, I can only commend your success at escaping ansible.

      Try mgmtconfig.

  • IsoKiero@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 month ago

    Nothing wrong with good old ssh. My VMs are different enough that building and maintaining ansible playbooks or something similar would be a bigger task than actually doing it in the traditional way. Maybe I could benefit by building simple playbooks to populate user accounts, ssh keys, smtp relay settings and other common things, but I don’t really set up new servers that often that it would justify spending time to set up tools for that.

  • 9point6@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 month ago

    Depends what you’re trying to do, really

    If you’re talking about going in and restarting containers and checking logs, there are tools like Portainer that give a nice UI you can quickly use from your phone

    If you’re talking about repetitive tasks, sometimes there’s a tool to automate it already (e.g. updates via watchtower, unattended-upgrades), and if not, you can write a script and possibly run it via a cronjob if that makes sense

    If you’re talking about doing new stuff, you either stick with the SSH & shell commands, or you look into IaC tools like ansible as another reply mentioned. Another option is something like Nix where the setup is defined in config, so you make your changes there

  • tal@lemmy.today
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 month ago

    If you’re connecting from a system that’s a long distance away from your server in terms of latency, mosh can be more comfortable to use than ssh.