Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Selfhosted
  3. Backup compose and env files

Backup compose and env files

Scheduled Pinned Locked Moved Selfhosted
selfhosted
14 Posts 8 Posters 92 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H [email protected]

    what about a local, encrypted backup

    P This user is from outside of this forum
    P This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #5

    It’s like you have secrets that you pull in to build your .env which should only be used by the stuff that needs it and it’s not shared.

    I’m assuming this is a production backup and the idea that someone has a prod .env file gives me the Willies.

    Id want to change all the cards.

    1 Reply Last reply
    0
    • P [email protected]

      Keeping backup of .env means exposing sensitive creds ?

      grimer@lemmy.worldG This user is from outside of this forum
      grimer@lemmy.worldG This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #6

      In my particular case I only have a few .env files and they don't have any credentials in them. This is mostly for the docker-compose files.

      ? 1 Reply Last reply
      0
      • grimer@lemmy.worldG [email protected]

        Just curious if there is an easy way to back up my docker-compose.yaml and .env files. I have the following directory structure for my containers:

        -docker
          -<name of container>
            -.env
            -docker-compose.yml
        

        I'd like to copy those two files for each container folder but no other subfolders that may also be in the container folder (config, data, etc). I've been trying to get my restic backups to do it but I just can't figure it out.

        Is there a better way?
        I'd like to have backups in case my entire server dies.___

        mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
        mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #7

        I mean... just back them up like any other file. If you want them and nothing else, then do an exclude all and then include after for those files.

        But you also need to backup the rest of the data, so I'm not sure why you'd want to exclude all the other folders.

        1 Reply Last reply
        0
        • P [email protected]

          Keeping backup of .env means exposing sensitive creds ?

          mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
          mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #8

          Backups are encrypted so it shouldn't be an issue.

          1 Reply Last reply
          0
          • grimer@lemmy.worldG [email protected]

            Just curious if there is an easy way to back up my docker-compose.yaml and .env files. I have the following directory structure for my containers:

            -docker
              -<name of container>
                -.env
                -docker-compose.yml
            

            I'd like to copy those two files for each container folder but no other subfolders that may also be in the container folder (config, data, etc). I've been trying to get my restic backups to do it but I just can't figure it out.

            Is there a better way?
            I'd like to have backups in case my entire server dies.___

            regalpotoo@lemmy.worldR This user is from outside of this forum
            regalpotoo@lemmy.worldR This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #9

            Check them into Git, but be cautious about credentials that might live in the env files that you don't want to expose publicly.

            grimer@lemmy.worldG 1 Reply Last reply
            0
            • regalpotoo@lemmy.worldR [email protected]

              Check them into Git, but be cautious about credentials that might live in the env files that you don't want to expose publicly.

              grimer@lemmy.worldG This user is from outside of this forum
              grimer@lemmy.worldG This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #10

              That is an option I've been thinking about but I've never used it, I'm not a dev. Maybe I'll look at it more seriously since it does sound like what would work best, I'd really apprecieate the versioning. Thanks!

              ? 1 Reply Last reply
              0
              • grimer@lemmy.worldG [email protected]

                Just curious if there is an easy way to back up my docker-compose.yaml and .env files. I have the following directory structure for my containers:

                -docker
                  -<name of container>
                    -.env
                    -docker-compose.yml
                

                I'd like to copy those two files for each container folder but no other subfolders that may also be in the container folder (config, data, etc). I've been trying to get my restic backups to do it but I just can't figure it out.

                Is there a better way?
                I'd like to have backups in case my entire server dies.___

                ? Offline
                ? Offline
                Guest
                wrote on last edited by
                #11

                I have mine in git! I have:

                -docker
                  - .env
                  - <thing name>
                      - dockers-compose.yml
                

                Then using docker compose --env-file ../.env -v up -d it uses the above .env file. (../ means up one folder)

                For more details and a bunch of my compose files checkout my repo!
                https://github.com/shadybraden/homelab/tree/main/docker

                1 Reply Last reply
                0
                • grimer@lemmy.worldG [email protected]

                  That is an option I've been thinking about but I've never used it, I'm not a dev. Maybe I'll look at it more seriously since it does sound like what would work best, I'd really apprecieate the versioning. Thanks!

                  ? Offline
                  ? Offline
                  Guest
                  wrote on last edited by
                  #12

                  Definitely worth a shot.

                  One thing I do to prevent stuff from getting into a public git repo is:

                  • In the git repo, make a file called .gitignore then add the line .env to it. Then git will ignore any file named .env
                  • edit compose files from a computer that is separate from the one that gets secrets. I have my desktop setup to push to github. Then I make a change, then simply run `git pull on my server to download the changes.
                  • make the .env only viewable by root (you'll have to use sudo nano) by running sudo chmod 600 .env && sudo chown root:root .env
                  1 Reply Last reply
                  0
                  • grimer@lemmy.worldG [email protected]

                    In my particular case I only have a few .env files and they don't have any credentials in them. This is mostly for the docker-compose files.

                    ? Offline
                    ? Offline
                    Guest
                    wrote on last edited by
                    #13

                    You can specify a folder in your files for configs, and a different one for the compose and env:

                    - config
                       - <container_config>
                    - docker
                      - container 
                          - compose.yml
                    
                    1 Reply Last reply
                    0
                    • grimer@lemmy.worldG [email protected]

                      Just curious if there is an easy way to back up my docker-compose.yaml and .env files. I have the following directory structure for my containers:

                      -docker
                        -<name of container>
                          -.env
                          -docker-compose.yml
                      

                      I'd like to copy those two files for each container folder but no other subfolders that may also be in the container folder (config, data, etc). I've been trying to get my restic backups to do it but I just can't figure it out.

                      Is there a better way?
                      I'd like to have backups in case my entire server dies.___

                      scrubbles@poptalk.scrubbles.techS This user is from outside of this forum
                      scrubbles@poptalk.scrubbles.techS This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #14

                      Docker compose in git. Env in 1password or whatever password manager you use. Most support uploading a raw file.

                      1 Reply Last reply
                      0
                      • System shared this topic on
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups