Kovah / LinkAce

LinkAce is a self-hosted archive to collect links of your favorite websites.
https://www.linkace.org
GNU General Public License v3.0
2.63k stars 164 forks source link

Docker environment variables #300

Open kgnfth opened 3 years ago

kgnfth commented 3 years ago

Is your feature request related to a problem? Please describe. I am using Caprover which allows us to create apps using yaml file so that we have a one-click-app, but the problem is we can't mount a file to file, we can only mount folder to folder

Describe the solution you'd like Allow specifing laravel env variables through docker like docker -e or docker-compose file Example popuplar laravel app https://github.com/LycheeOrg/Lychee-Docker see inject.sh

Additional context Caprover uses yaml a docker-compose equivalent

captainVersion: 4
services:
    # LinkAce
    $$cap_appname:
        image: linkace/linkace:$$cap_linkace_version
        restart: unless-stopped
        depends_on:
            - $$cap_appname-mariadb
            - $$cap_appname-redis
        environment:
            APP_KEY: $$cap_gen_random_hex(32)
            DB_HOST: srv-captain--$$cap_appname-mariadb
            DB_PORT: 3306
            DB_DATABASE: $$cap_mariadb-db
            DB_USERNAME: $$cap_mariadb-user
            DB_PASSWORD: $$cap_mariadb-pass
            REDIS_HOST: srv-captain--$$cap_appname-redis
            REDIS_PASSWORD: $$cap_redis_password
            REDIS_PORT: 6379
            SESSION_DRIVER: redis
            CACHE_DRIVER: redis
        volumes:
            - $$cap_appname-app:/app
            - $$cap_appname-logs:/app/storage/logs

    # MariaDB
    $$cap_appname-mariadb:
        image: mariadb:$$cap_mariadb_version
        environment:
            MYSQL_RANDOM_ROOT_PASSWORD: '1'
            MYSQL_DATABASE: $$cap_mariadb-db
            MYSQL_USER: $$cap_mariadb-user
            MYSQL_PASSWORD: $$cap_mariadb-pass
        volumes:
            - $$cap_appname-mariadb-data:/var/lib/mysql
        restart: unless-stopped
        caproverExtra:
            notExposeAsWebApp: 'true'

    # Redis
    $$cap_appname-redis:
        volumes:
            - $$cap_appname-redis-data:/data
        environment:
            REDIS_PASSWORD: $$cap_redis_password
        caproverExtra:
            dockerfileLines:
                - FROM redis:alpine
                - CMD exec redis-server --requirepass "$$cap_redis_password"
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_linkace_version
          label: LinkAce Version
          defaultValue: v1.6.3
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/linkace/linkace/tags
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_mariadb_version
          label: MariaDB Version
          defaultValue: '10.5.6'
          description: Checkout their docker page for the valid tags https://hub.docker.com/r/library/mariadb/tags/
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_mariadb-db
          label: MariaDB Database
          description: Database name for LinkAce
          defaultValue: 'linkace'

        - id: $$cap_mariadb-user
          label: MariaDB User
          description: Database User for LinkAce
          defaultValue: 'linkace'

        - id: $$cap_mariadb-pass
          label: MariaDB database user password
          description: Super secret database user password
          defaultValue: $$cap_gen_random_hex(12)

        - id: $$cap_redis_password
          label: Redis Password
          description: Super secret redis password.
          defaultValue: $$cap_gen_random_hex(12)
    instructions:
        start: |-
            Your self-hosted bookmark archive. Free and open source.
        end: |-
            Your self-hosted bookmark archive. Free and open source.
    displayName: LinkAce
    isOfficial: true
    description: Your self-hosted bookmark archive. Free and open source.
    documentation: Taken from https://www.linkace.org/docs/.

With this yaml file, everyone who uses caprover can install LinkAce with just a click

image

Kovah commented 3 years ago

Hi! Thanks for putting this together! I will add this as a guide to the community forum.