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

Add the buildarr compose command #73

Merged
merged 4 commits into from
Mar 25, 2023
Merged

Add the buildarr compose command #73

merged 4 commits into from
Mar 25, 2023

Conversation

Callum027
Copy link
Member

@Callum027 Callum027 commented Mar 25, 2023

This PR adds a new buildarr compose CLI command for generating Docker Compose files from Buildarr configurations, and log the contents of the file to standard output.

The file itself is very basic and will probably require adjustment from the user to get it to work the way they want, but the Docker Compose file will have the following:

  • Image tags matching the version defined in the Buildarr configuration file
  • Restart policy set on all services
  • Any required volumes created
  • Service dependencies added based on instance-to-instance links present in the Buildarr configuration
  • Buildarr itself added as a service in daemon mode, to deploy instance configurations and keep them up to date

To save the contents to the file, simply run:

buildarr compose /opt/buildarr/buildarr.yml > /opt/buildarr/docker-compose.yml

Example buildarr.yml:

---
sonarr:
  instances:
    sonarr-hd: {}
    sonarr-4k:
      settings:
        media_management:
          root_folders:
            - /tmp/videos
        profiles:
          language_profiles:
            definitions:
              English:
                languages:
                  - "English"
        import_lists:
          definitions:
            "Sonarr (HD)":
              type: "sonarr"
              root_folder: "/tmp/videos"
              quality_profile: "Any"
              language_profile: "English"
              full_url: "http://sonarr-hd:8989"
              instance_name: "sonarr-hd"

Output docker-compose.yml:

---
version: '3.7'
services:
  sonarr_sonarr-hd:
    image: lscr.io/linuxserver/sonarr:latest
    volumes:
      sonarr_sonarr-hd: /config
    hostname: sonarr-hd
    restart: always
  sonarr_sonarr-4k:
    image: lscr.io/linuxserver/sonarr:latest
    volumes:
      sonarr_sonarr-4k: /config
    hostname: sonarr-4k
    restart: always
    depends_on:
    - sonarr_sonarr-hd
  buildarr:
    image: callum027/buildarr:0.4.0
    command:
    - daemon
    - /config/buildarr.yml
    volumes:
    - type: bind
      source: /opt/buildarr
      target: /config
    restart: always
    depends_on:
    - sonarr_sonarr-hd
    - sonarr_sonarr-4k
volumes:
- sonarr_sonarr-4k
- sonarr_sonarr-hd

@Callum027 Callum027 added enhancement New feature or request plugins Vendored plugin or plugin API-related issue or pull request cli Issue or pull request related to the Buildarr CLI config Issue or pull request related to Buildarr or plugin configuration labels Mar 25, 2023
@Callum027 Callum027 added this to the v0.4.0 milestone Mar 25, 2023
@Callum027 Callum027 self-assigned this Mar 25, 2023
@Callum027 Callum027 merged commit 00ce0e0 into main Mar 25, 2023
@Callum027 Callum027 deleted the 7-generate-compose branch March 25, 2023 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Issue or pull request related to the Buildarr CLI config Issue or pull request related to Buildarr or plugin configuration enhancement New feature or request plugins Vendored plugin or plugin API-related issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-generation of Docker Compose environment files reflecting the Buildarr configuration
1 participant