Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure volumes, directories and files for any role #697

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aka47
Copy link

@aka47 aka47 commented Mar 1, 2024

For the app, the traefic role, and any accessory you can configure files, volumes, and directories from your project to be accessible inside the docker container.

The files and directories are uploaded to the host and mounted via docker volumes to the docker container.
This worked previously only for accessories. So I moved code related to this from accessory configuration to a new class to make it useable for the traefik proxy and the main app as well.

With this change we can add in the config for traefik volumes, files and folders

traefik:
  files:
    - config/traefik.yaml:/etc/traefik/traefik.yaml
  directories:
    - config/traefik.d:/etc/traefik/traefik.d
  volumes:
    - /mnt/volume-data/letsencrypt/acme.json:/letsencrypt/acme.json

For the main app config it looks like this:

volumes:
  - "/mnt/volume-data/wordpress-data:/var/www/html"
files:
  - apache.conf:/etc/apache2/sites-enabled/wp3.conf
directories:
  - config/apache/:/etc/conf-avail

And it works as it currently does for accessories.

accessories:
  redis:
    files:
      - config/redis.conf:/etc/redis/redis.conf
    directories:
      - config/conf.d:/etc/conf/conf.d
    volumes:
      - /mnt/volume-data/conf/conf.json:/conf/conf.json

we move code related to docker volumes from accessory configuration to a new class to make it useable for the traefik proxy

With this change we can add in the config for traefik a volume, files and folders
for the app, the traefic role and any accessory you can configure files and directories from your project to be mounted to the docker container.

The files and directories are uploaded to the host and mounted via docker volumes to the docker container.
@aka47 aka47 marked this pull request as ready for review March 1, 2024 15:14
@aka47 aka47 force-pushed the volumes-and-files-for-traefik branch from 7f0ae98 to bb80866 Compare March 1, 2024 15:36
def upload(role, hosts)
mutating do
on(hosts) do
volumes_config = case role.class.to_s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not match on role.class?

Copy link
Author

@aka47 aka47 Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be safe, in case of a "Constant not found" exception, and also stay with the convention that exists around this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants