summaryrefslogtreecommitdiffhomepage
path: root/public/v4/apps/invoiceninja.yml
blob: 759d4c10cdd25cb7a60f11ec08d2dd64efbdfe9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
captainVersion: 4
caproverOneClickApp:
    instructions:
        start: |-
            You will need your own "Invoice Ninja App Key", you can generate a new one with
            `docker run --rm invoiceninja/invoiceninja php artisan key:generate --show`
            Detailed instructions in the official [Invoice Ninja Repo](https://github.com/invoiceninja/dockerfiles#alternatively-get-started-with-docker-compose)
            Some variables have default values and others need to be manually added into the App Config of AppName-app. Check the sample [env file](https://github.com/invoiceninja/invoiceninja/blob/master/.env.example) from the official repo.
        end: >
            Invoice Ninja is deployed, it might take few moments before it's fully started.
            Initial user is: $$cap_invoiceninja_admin_user_email with password $$cap_invoiceninja_admin_pass.
            Some variables have default values and can/must be set in App Config of $$cap_appname-app.
            Make sure to enable the email service by adding the neccesary values in in App Config of $$cap_appname-app.

    displayName: Invoice Ninja
    isOfficial: true
    description: Small Business Invoicing & Payments.
    documentation: |-
        Based on https://github.com/invoiceninja/dockerfiles
        - Changed the db backup system to use automysqlbackup

    variables:
        - id: $$cap_invoiceninja_VERSION
          label: Invoice Ninja Version
          defaultValue: '5.8.52'
          description: It's a good idea to check for breaking changes between versions. Check current version [on GitHub](https://github.com/invoiceninja/dockerfiles/releases)
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_invoiceninja_APP_KEY
          label: Invoice App Key
          description: Your own App Key by Invoice Ninja generated from the terminal. See description above.
          validRegex: /^base64\:[A-Za-z0-9+\/]+={0,2}$/
        - id: $$cap_invoiceninja_admin_user_email
          label: ADMIN_USER_EMAIL
          defaultValue: [email protected]
          description: 'Admin user for Invoice Ninja'
          validRegex: /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/

        - id: $$cap_invoiceninja_admin_pass
          label: ADMIN_USER_PASS
          defaultValue: $$cap_gen_random_hex(10)
          description: 'Admin password for Invoice Ninja'
          validRegex: /.{1,}/

        - id: $$cap_invoiceninja_DB_USERNAME
          label: DB_USERNAME
          defaultValue: ninja
          validRegex: /^([a-zA-Z0-9\-\.\_])+$/

        - id: $$cap_invoiceninja_DB_PASSWORD
          label: DB_PASSWORD
          defaultValue: $$cap_gen_random_hex(10)
          description: 'The password of the Invoice Ninja database user.'
          validRegex: /.{1,}/

        - id: $$cap_invoiceninja_DB_DATABASE
          label: DB_DATABASE
          defaultValue: ninja
          validRegex: /^([a-zA-Z0-9\-\.\_])+$/

        - id: $$cap_invoiceninja_DB_ROOT_PASSWORD
          label: DB_ROOT_PASSWORD
          defaultValue: $$cap_gen_random_hex(10)
          description: 'The password of DB superuser.'
          validRegex: /.{1,}/

        - id: $$cap_invoiceninja_debugmode
          label: Debug Mode
          defaultValue: 'false'
          description: 'Useful for debugging, not suitable for production'
          validRegex: /^(true|false)$/

services:
    $$cap_appname-app:
        restart: always
        depends_on:
            - $$cap_appname-db
        user:
        environment:
            APP_URL: http://$$cap_appname.$$cap_root_domain
            APP_KEY: $$cap_invoiceninja_APP_KEY
            APP_DEBUG: $$cap_invoiceninja_debugmode
            REQUIRE_HTTPS: false
            PHANTOMJS_PDF_GENERATION: false
            PDF_GENERATOR: snappdf
            QUEUE_CONNECTION: database
            DB_HOST: srv-captain--$$cap_appname-db
            DB_PORT: 3306
            DB_DATABASE: $$cap_invoiceninja_DB_DATABASE
            DB_USERNAME: $$cap_invoiceninja_DB_USERNAME
            DB_PASSWORD: $$cap_invoiceninja_DB_PASSWORD
            MAIL_DRIVER: ''
            MAIL_PORT: ''
            MAIL_ENCRYPTION: ''
            MAIL_HOST: ''
            MAIL_USERNAME: ''
            MAIL_FROM_ADDRESS: ''
            MAIL_FROM_NAME: ''
            MAIL_PASSWORD: ''
            TRUSTED_PROXIES: 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
            # GoCardless/Nordigen API key for banking integration
            NORDIGEN_SECRET_ID: ''
            NORDIGEN_SECRET_KEY: ''
            # These can be removed after initial login
            IN_USER_EMAIL: $$cap_invoiceninja_admin_user_email
            IN_PASSWORD: $$cap_invoiceninja_admin_pass

        volumes:
            - $$cap_appname-app-public:/var/www/app/public
            - $$cap_appname-app-storage:/var/www/app/storage
        caproverExtra:
            notExposeAsWebApp: true
            dockerfileLines:
                - FROM invoiceninja/invoiceninja:$$cap_invoiceninja_VERSION
                - USER root
                - RUN mkdir -p /var/www/app/public /var/www/app/storage
                - RUN chown 1500:1500 /var/www/app/*
                - USER 1500

    $$cap_appname-db:
        restart: always
        image: mariadb:10.4
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_invoiceninja_DB_ROOT_PASSWORD
            MYSQL_USER: $$cap_invoiceninja_DB_USERNAME
            MYSQL_PASSWORD: $$cap_invoiceninja_DB_PASSWORD
            MYSQL_DATABASE: $$cap_invoiceninja_DB_DATABASE
        volumes:
            - $$cap_appname-db:/var/lib/mysql
        caproverExtra:
            notExposeAsWebApp: true

    $$cap_appname:
        restart: always
        depends_on:
            - $$cap_appname-app
        environment:
            APP_CONTAINER: srv-captain--$$cap_appname-app:9000
        volumes:
            - $$cap_appname-app-public:/var/www/app/public
        caproverExtra:
            # Workaround for hard-coded container name in nginx config
            dockerfileLines:
                - FROM nginx:1.21
                - ADD https://raw.githubusercontent.com/invoiceninja/dockerfiles/$$cap_invoiceninja_VERSION/config/nginx/in-vhost.conf /etc/nginx/templates/in-vhost.conf.template
                - RUN sed -i 's/app:9000/${APP_CONTAINER}/g' /etc/nginx/templates/in-vhost.conf.template

    $$cap_appname-db-backup:
        restart: always
        image: selim13/automysqlbackup:2.6-9
        depends_on:
            - $$cap_appname-db
        environment:
            USERNAME: root
            PASSWORD: $$cap_invoiceninja_DB_ROOT_PASSWORD
            DBHOST: srv-captain--$$cap_appname-db
            DBEXCLUDE: 'performance_schema information_schema'
            CRON_SCHEDULE: '0 0 * * *'
            EXTRA_OPTS: '--single-transaction'
        volumes:
            - $$cap_appname-db-backup:/backup
        caproverExtra:
            notExposeAsWebApp: true