Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. App with multiple endpoints. How to share addons?

App with multiple endpoints. How to share addons?

Scheduled Pinned Locked Moved Unsolved App Packaging & Development
17 Posts 8 Posters 2.4k Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    baptistearno
    wrote on last edited by
    #1

    Hi,

    I'm the founder of https://typebot.io. I'd like to package Typebot for Cloudron.

    Typebot is basically composed of 2 applications: the builder (chatbot editor) and the viewer (chatbot execution).

    version: '3.3'
    services:
      typebot-db:
        image: postgres:13
        restart: always
        volumes:
          - db_data:/var/lib/postgresql/data
        environment:
          - POSTGRES_DB=typebot
          - POSTGRES_PASSWORD=typebot
      typebot-builder:
        image: baptistearno/typebot-builder:latest
        restart: always
        depends_on:
          - typebot-db
        ports:
          - '8080:3000'
        extra_hosts:
          - 'host.docker.internal:host-gateway'
        # See https://docs.typebot.io/self-hosting/configuration/builder for more configuration options
        environment:
          - DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot
          - NEXTAUTH_URL=<your-builder-url>
          - NEXT_PUBLIC_VIEWER_URL=<your-viewer-url>
          - ENCRYPTION_SECRET=<your-encryption-secret>
          - ADMIN_EMAIL=<your-admin-email>
      typebot-viewer:
        image: baptistearno/typebot-viewer:latest
        restart: always
        ports:
          - '8081:3000'
        # See https://docs.typebot.io/self-hosting/configuration/viewer for more configuration options
        environment:
          - DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot
          - NEXT_PUBLIC_VIEWER_URL=<your-viewer-url>
          - ENCRYPTION_SECRET=<your-encryption-secret>
          - NEXTAUTH_URL=<your-builder-url>
    volumes:
      db_data:
    
    

    From what I understand, I'll need to implement 2 distinct Cloudron apps?

    When it comes to postgresql addons, can I make sure it is shared between the 2 apps?

    1 Reply Last reply
    4
    • jeauJ jeau referenced this topic on
    • jeauJ Offline
      jeauJ Offline
      jeau
      App Dev
      wrote on last edited by
      #2

      @girish @nebulon what is the best way to solve the issue raised by @baptistearno?

      1 Reply Last reply
      1
      • jdaviescoatesJ Offline
        jdaviescoatesJ Offline
        jdaviescoates
        wrote on last edited by jdaviescoates
        #3

        I don't know the answer but I'd look for clues in the packages of other apps with multiple end points like eg Minio (I think)

        I use Cloudron with Gandi & Hetzner

        1 Reply Last reply
        0
        • nebulonN Offline
          nebulonN Offline
          nebulon
          Staff
          wrote on last edited by
          #4

          For this you probably want to use the multiDomain feature https://docs.cloudron.io/packaging/manifest/#multidomain

          Or also if one of the two processes can work off a subpath of the same domain, you may add a reverse proxy in the app to proxy pass to the corresponding internal server?

          1 Reply Last reply
          2
          • B Offline
            B Offline
            baptistearno
            wrote on last edited by baptistearno
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • B Offline
              B Offline
              baptistearno
              wrote on last edited by
              #6

              Is the container run in read-only mode?

              My start script need to create a file but I keep getting the error: "touch: cannot touch './builder/apps/builder/public/__env.js': Read-only file system"

              I tried to specifically enable all modes to that public folder with RUN chmod 777 -R ./builder/apps/builder/public && chmod 777 -R ./viewer/apps/viewer/public. But that just won't do it.

              Here are the files: https://github.com/baptisteArno/typebot.io/pull/550/files

              Am I missing something?

              robiR 1 Reply Last reply
              0
              • B baptistearno

                Is the container run in read-only mode?

                My start script need to create a file but I keep getting the error: "touch: cannot touch './builder/apps/builder/public/__env.js': Read-only file system"

                I tried to specifically enable all modes to that public folder with RUN chmod 777 -R ./builder/apps/builder/public && chmod 777 -R ./viewer/apps/viewer/public. But that just won't do it.

                Here are the files: https://github.com/baptisteArno/typebot.io/pull/550/files

                Am I missing something?

                robiR Offline
                robiR Offline
                robi
                wrote on last edited by
                #7

                @baptistearno make sure to se it up to run from /app/data and not /app/code

                Conscious tech

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  baptistearno
                  wrote on last edited by baptistearno
                  #8

                  @robi I tried to run the script from the /app/data folder (https://github.com/baptisteArno/typebot.io/pull/550/commits/6da7ade5dd4a4f24c6185472b66df0715c94c6a5#diff-f04ded0885f91a28ae388b09ec3477ec378337f483257bf22e0eaf813c3704e5) but no luck.

                  Still getting: touch: cannot touch './builder/apps/builder/public/__env.js': Read-only file system

                  Did I understand correctly what you suggested?

                  robiR 1 Reply Last reply
                  0
                  • nebulonN Offline
                    nebulonN Offline
                    nebulon
                    Staff
                    wrote on last edited by
                    #9

                    So in Cloudron only the folders /app/data, /run/ and /tmp/ are write-able. The app code should remain in read-only storage, but if an app needs to write to disk, then depending on the use-case one of those 3 folders should be symlinked or configured to be used. Note that only /app/data will get backed up.

                    1 Reply Last reply
                    2
                    • B baptistearno

                      @robi I tried to run the script from the /app/data folder (https://github.com/baptisteArno/typebot.io/pull/550/commits/6da7ade5dd4a4f24c6185472b66df0715c94c6a5#diff-f04ded0885f91a28ae388b09ec3477ec378337f483257bf22e0eaf813c3704e5) but no luck.

                      Still getting: touch: cannot touch './builder/apps/builder/public/__env.js': Read-only file system

                      Did I understand correctly what you suggested?

                      robiR Offline
                      robiR Offline
                      robi
                      wrote on last edited by
                      #10

                      @baptistearno looks like you need to adjust the ENVSH_* variables to something more appropriate to what @nebulon said.

                      Conscious tech

                      1 Reply Last reply
                      1
                      • B Offline
                        B Offline
                        baptistearno
                        wrote on last edited by baptistearno
                        #11

                        EDIT: fixed! I increased the container resources

                        Thank you for the help guys @robi @nebulon, I'm almost there!

                        Now, I have an issue with running the 2 apps using supervisor. Here is the final logs:

                        Jun 09 12:56:36 ==> Starting supervisor
                        Jun 09 12:56:37 2023-06-09 10:56:37,243 INFO Included extra file "/etc/supervisor/conf.d/builder.conf" during parsing
                        Jun 09 12:56:37 2023-06-09 10:56:37,244 INFO Included extra file "/etc/supervisor/conf.d/viewer.conf" during parsing
                        Jun 09 12:56:37 2023-06-09 10:56:37,244 INFO Set uid to user 0 succeeded
                        Jun 09 12:56:37 2023-06-09 10:56:37,250 INFO supervisord started with pid 1
                        Jun 09 12:56:38 2023-06-09 10:56:38,255 INFO spawned: 'builder' with pid 195
                        Jun 09 12:56:38 2023-06-09 10:56:38,258 INFO spawned: 'viewer' with pid 196
                        Jun 09 12:56:39 - info Loaded env from /app/code/viewer/apps/viewer/.env.production
                        Jun 09 12:56:39 2023-06-09 10:56:39,738 INFO success: viewer entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
                        Jun 09 12:56:39 2023-06-09 10:56:39,787 INFO reaped unknown pid 184 (exit status 0)
                        Jun 09 12:56:39 Listening on port 3001 url: http://b02f726c-1c16-4a23-bfad-9ce3f23df732:3001
                        Jun 09 12:56:40 - info Loaded env from /app/code/builder/apps/builder/.env.production
                        Jun 09 12:56:40 2023-06-09 10:56:40,077 INFO success: builder entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
                        Jun 09 12:56:40 => Healtheck error: Error: connect ECONNREFUSED 172.18.20.229:3000
                        Jun 09 12:56:43 Listening on port 3000 url: http://b02f726c-1c16-4a23-bfad-9ce3f23df732:3000
                        Jun 09 13:00:49 - info Loaded env from /app/code/builder/apps/builder/.env.production
                        email undefined
                        localstorage undefined
                        postgresql undefined
                        

                        It seems to properly launch the 2 apps but then it doesn't succeed in doing the health check.
                        The server seems to be slow… The logs take some time to load etc… but when I check the resource usage, it is just fine:

                        CleanShot 2023-06-09 at 12.59.58@2x.png

                        Is the container restricted in terms of resource?

                        Here are the new files: https://github.com/baptisteArno/typebot.io/pull/550/commits/c307635148b04184d12795614a98cedec81d2d9b

                        girishG 1 Reply Last reply
                        3
                        • jeauJ Offline
                          jeauJ Offline
                          jeau
                          App Dev
                          wrote on last edited by
                          #12

                          thanks for the work @baptistearno

                          by default each app has a memory limit set at 256MB, in your manifest CloudronManifest.jsonyou can adjust this default value for your app.

                          https://docs.cloudron.io/packaging/manifest/#memorylimit

                          1 Reply Last reply
                          2
                          • B baptistearno

                            EDIT: fixed! I increased the container resources

                            Thank you for the help guys @robi @nebulon, I'm almost there!

                            Now, I have an issue with running the 2 apps using supervisor. Here is the final logs:

                            Jun 09 12:56:36 ==> Starting supervisor
                            Jun 09 12:56:37 2023-06-09 10:56:37,243 INFO Included extra file "/etc/supervisor/conf.d/builder.conf" during parsing
                            Jun 09 12:56:37 2023-06-09 10:56:37,244 INFO Included extra file "/etc/supervisor/conf.d/viewer.conf" during parsing
                            Jun 09 12:56:37 2023-06-09 10:56:37,244 INFO Set uid to user 0 succeeded
                            Jun 09 12:56:37 2023-06-09 10:56:37,250 INFO supervisord started with pid 1
                            Jun 09 12:56:38 2023-06-09 10:56:38,255 INFO spawned: 'builder' with pid 195
                            Jun 09 12:56:38 2023-06-09 10:56:38,258 INFO spawned: 'viewer' with pid 196
                            Jun 09 12:56:39 - info Loaded env from /app/code/viewer/apps/viewer/.env.production
                            Jun 09 12:56:39 2023-06-09 10:56:39,738 INFO success: viewer entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
                            Jun 09 12:56:39 2023-06-09 10:56:39,787 INFO reaped unknown pid 184 (exit status 0)
                            Jun 09 12:56:39 Listening on port 3001 url: http://b02f726c-1c16-4a23-bfad-9ce3f23df732:3001
                            Jun 09 12:56:40 - info Loaded env from /app/code/builder/apps/builder/.env.production
                            Jun 09 12:56:40 2023-06-09 10:56:40,077 INFO success: builder entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
                            Jun 09 12:56:40 => Healtheck error: Error: connect ECONNREFUSED 172.18.20.229:3000
                            Jun 09 12:56:43 Listening on port 3000 url: http://b02f726c-1c16-4a23-bfad-9ce3f23df732:3000
                            Jun 09 13:00:49 - info Loaded env from /app/code/builder/apps/builder/.env.production
                            email undefined
                            localstorage undefined
                            postgresql undefined
                            

                            It seems to properly launch the 2 apps but then it doesn't succeed in doing the health check.
                            The server seems to be slow… The logs take some time to load etc… but when I check the resource usage, it is just fine:

                            CleanShot 2023-06-09 at 12.59.58@2x.png

                            Is the container restricted in terms of resource?

                            Here are the new files: https://github.com/baptisteArno/typebot.io/pull/550/commits/c307635148b04184d12795614a98cedec81d2d9b

                            girishG Offline
                            girishG Offline
                            girish
                            Staff
                            wrote on last edited by
                            #13

                            @baptistearno Just saw https://docs.typebot.io/self-hosting/cloudron . This is awesome!

                            Are you open to having the app published on the App Store ? If so, I can create a repo in our gitlab, give you permissions as well and we can proceed to get it published. Note that GitLab is only for the cloudron package and not for your app development (which can continue wherever you want).

                            LanhildL 1 Reply Last reply
                            5
                            • S Offline
                              S Offline
                              staypath
                              wrote on last edited by
                              #14

                              @baptistearno Man, this is so great. Looks like a lot of work was put in. Awesome job, and thanks for the effort!

                              1 Reply Last reply
                              2
                              • girishG girish

                                @baptistearno Just saw https://docs.typebot.io/self-hosting/cloudron . This is awesome!

                                Are you open to having the app published on the App Store ? If so, I can create a repo in our gitlab, give you permissions as well and we can proceed to get it published. Note that GitLab is only for the cloudron package and not for your app development (which can continue wherever you want).

                                LanhildL Offline
                                LanhildL Offline
                                Lanhild
                                App Dev
                                wrote on last edited by
                                #15

                                @girish FYI https://github.com/baptisteArno/typebot.io/issues/568

                                robiR 1 Reply Last reply
                                2
                                • LanhildL Lanhild

                                  @girish FYI https://github.com/baptisteArno/typebot.io/issues/568

                                  robiR Offline
                                  robiR Offline
                                  robi
                                  wrote on last edited by
                                  #16

                                  @Lanhild can you respond with the link to the message from @girish above? (hover over the #13 link)

                                  Conscious tech

                                  1 Reply Last reply
                                  1
                                  • girishG Offline
                                    girishG Offline
                                    girish
                                    Staff
                                    wrote on last edited by
                                    #17

                                    I left a note in that issue.

                                    1 Reply Last reply
                                    2
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Bookmarks
                                    • Search