caprover / one-click-apps

Community Maintained One Click Apps (https://github.com/caprover/caprover)
Apache License 2.0
558 stars 546 forks source link

App Suggestion: Vikunja #349

Open jaideep-bishnoi opened 3 years ago

jaideep-bishnoi commented 3 years ago

Please tell us what app you'd like to see on CapRover as a one-click app. Vikunja

Do you know if there is any official Docker image for the app? https://hub.docker.com/r/vikunja/api https://hub.docker.com/r/vikunja/frontend https://kolaente.dev/vikunja/

So far I came up with this caprover template. The issue I am getting into is Vikunja hit their API as example.com/api/whatever-endpoint but with both frontend and backend being separate docker files, I can't seem to figure out, how to get them to interact with each other since both images are getting their own cap_appname URL. I really appreciate it if anyone wants to help me with this or wants to collaborate on adding more one-click apps.


services:
    $$cap_appname-db:
        image: $$cap_db_type:$$cap_database_version
        volumes:
            - $$cap_appname-db-data:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_db_pass
            MYSQL_DATABASE: vikunja
            MYSQL_USER: $$cap_db_user
            MYSQL_PASSWORD: $$cap_db_pass
        caproverExtra:
            dockerfileLines:
                - FROM mariadb:$$cap_database_version
                - CMD ["--character-set-server=$$cap_charset", "--collation-server=$$cap_collation"]
        notExposeAsWebApp: 'true'
    $$cap_appname-api:
        depends_on:
            - $$cap_appname-db
        image: vikunja/api:latest
        ports:
          # change the host port to your liking
          - 8111:80
        volumes:
            - $$cap_appname-files:/app/vikunja/files
        environment:
            VIKUNJA_DATABASE_HOST: srv-captain--$$cap_appname-db:3306
            VIKUNJA_DATABASE_PASSWORD: $$cap_db_pass
            VIKUNJA_DATABASE_TYPE: mysql
            VIKUNJA_DATABASE_USER: $$cap_db_user
            VIKUNJA_SERVICE_JWTSECRET: $$cap_gen_random_hex(32)
    $$cap_appname-frontend:
        image: vikunja/frontend
        restart: unless-stopped
caproverOneClickApp:
    variables:
        - id: $$cap_charset
          label: Default server character set
          description: See the MariaDB website for supported character sets (https://mariadb.com/kb/en/library/supported-character-sets-and-collations/#character-sets)
          defaultValue: utf8mb4
        - id: $$cap_collation
          label: Default server collation
          description: See the MariaDB website for supported collations (https://mariadb.com/kb/en/library/supported-character-sets-and-collations/#collations)
          defaultValue: utf8mb4_unicode_ci
        - id: $$cap_db_type
          label: Database Type
          defaultValue: mariadb
          description: You can either choose mariadb or mysql, you need to change the version according to which DB is selected. It is case sensitive.
          validRegex: /^(mysql|mariadb)$/
        - id: $$cap_database_version
          label: Database Version, default is MariaDB
          defaultValue: '10'
          description: Check out the Docker pages for the valid tags https://hub.docker.com/r/library/mysql/tags/ or https://hub.docker.com/_/mariadb?tab=tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_db_user
          label: Database user
          defaultValue: vikunjauser
          validRegex: /^([a-zA-Z0-9])+$/
        - id: $$cap_db_pass
          label: Database password
          description: ''
          validRegex: /^(\w|[^\s"'\\])+$/
    instructions:
        start: >-
            The process will take about a minute for the process to finish.
        end: >
            Vikunja is deployed and available as $$cap_appname . 
             IMPORTANT: It will take up to 2 minutes for Meli to be ready. Before that, you might see a 502 error page.
    displayName: Vikunja
    isOfficial: false
    description: The to-do app to organize your life.
    documentation: Taken from https://vikunja.io/docs/installing/
kgnfth commented 3 years ago

Api port is 3456 Front port is 80, this defaults to containerHttpPort so you dont need to port map just enable SSL on bot api and front after that on the login page you have to change the the api url to eg: https://cap_appname-api.yourdomain.com/api/v1 i looked through the documentation and could not find a way to specify the api url for the frontend but this could be archived by editing the nginx in frontend by adding

    location ~* ^/(api|dav|\.well-known)/ {
        proxy_pass http://srv-captain--APP_NAME-api:3456;
        client_max_body_size 20M;
    }

right after

proxy_set_header X-Forwarded-Proto $scheme;

Change APP_NAME to your app name!

use this temlpate

captainVersion: 4
services:
    $$cap_appname-db:
        image: $$cap_db_type:$$cap_database_version
        volumes:
            - $$cap_appname-db-data:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_db_pass
            MYSQL_DATABASE: vikunja
            MYSQL_USER: $$cap_db_user
            MYSQL_PASSWORD: $$cap_db_pass
        caproverExtra:
            dockerfileLines:
                - FROM mariadb:$$cap_database_version
                - CMD ["--character-set-server=$$cap_charset", "--collation-server=$$cap_collation"]
        notExposeAsWebApp: 'true'
    $$cap_appname-api:
        depends_on:
            - $$cap_appname-db
        image: vikunja/api:latest
        volumes:
            - $$cap_appname-files:/app/vikunja/files
        environment:
            VIKUNJA_DATABASE_HOST: srv-captain--$$cap_appname-db:3306
            VIKUNJA_DATABASE_PASSWORD: $$cap_db_pass
            VIKUNJA_DATABASE_TYPE: mysql
            VIKUNJA_DATABASE_USER: $$cap_db_user
            VIKUNJA_SERVICE_JWTSECRET: $$cap_gen_random_hex(32)
        caproverExtra:
            containerHttpPort: '3456'
    $$cap_appname-frontend:
        image: vikunja/frontend
        restart: unless-stopped
caproverOneClickApp:
    variables:
        - id: $$cap_charset
          label: Default server character set
          description: See the MariaDB website for supported character sets (https://mariadb.com/kb/en/library/supported-character-sets-and-collations/#character-sets)
          defaultValue: utf8mb4
        - id: $$cap_collation
          label: Default server collation
          description: See the MariaDB website for supported collations (https://mariadb.com/kb/en/library/supported-character-sets-and-collations/#collations)
          defaultValue: utf8mb4_unicode_ci
        - id: $$cap_db_type
          label: Database Type
          defaultValue: mariadb
          description: You can either choose mariadb or mysql, you need to change the version according to which DB is selected. It is case sensitive.
          validRegex: /^(mysql|mariadb)$/
        - id: $$cap_database_version
          label: Database Version, default is MariaDB
          defaultValue: '10'
          description: Check out the Docker pages for the valid tags https://hub.docker.com/r/library/mysql/tags/ or https://hub.docker.com/_/mariadb?tab=tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_db_user
          label: Database user
          defaultValue: vikunjauser
          validRegex: /^([a-zA-Z0-9])+$/
        - id: $$cap_db_pass
          label: Database password
          description: ''
          validRegex: /^(\w|[^\s"'\\])+$/
    instructions:
        start: >-
            The process will take about a minute for the process to finish.
        end: >
            Vikunja is deployed and available as $$cap_appname . 
             IMPORTANT: It will take up to 2 minutes for Meli to be ready. Before that, you might see a 502 error page.
    displayName: Vikunja
    isOfficial: false
    description: The to-do app to organize your life.
    documentation: Taken from https://vikunja.io/docs/installing/