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. LAMP
  3. How to run AI models in LAMP App

How to run AI models in LAMP App

Scheduled Pinned Locked Moved LAMP
13 Posts 2 Posters 1.9k Views 4 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.
    • robiR Offline
      robiR Offline
      robi
      wrote on last edited by robi
      #1

      Most of the AI projects are based on python and are CLI based until someone puts a node UI on top.

      If you plan to work on getting things like h2ogpt or chatbot-ui to work with gpt-llama.cpp or lit-parrot on Cloudron, you can start with the LAMP app, provided you specify a few environment variables.

      1. python & npm will need the HOME env variable set, I used:
        export HOME=/app/data
      2. pip will need the installed bits to be in the PATH, I used:
        export PATH=$PATH:/app/data/.local/bin

      You can put both of these in the /app/data/run.sh file so they're set every time you open the terminal.

      export HOME=/app/data
      export PATH=$PATH:/app/data/.local/bin
      

      Then simply git clone the repos, install deps, adjust ports & env vars, set the proxy (see below), grab a model, run the backend app, run the chatbot-ui (setup guide) and see the model spring to life.

      Have fun!

      Conscious tech

      1 Reply Last reply
      6
      • robiR Offline
        robiR Offline
        robi
        wrote on last edited by robi
        #2

        @staff does the .htaccess proxy trick not work anymore?:

        RewriteEngine on
        RewriteRule ^/(.*)?$ http://localhost:8000/$1 [P,L]
        

        The node app is running on port 8000 and responds to curl, but the rule doesn't seem to pull it up from a browser, only the default lamp index or a 404 if I drop the '^/'.

        Anyone else have this as a working example?

        See lamp.demo.cloudron.io

        Conscious tech

        girishG 1 Reply Last reply
        1
        • robiR robi

          @staff does the .htaccess proxy trick not work anymore?:

          RewriteEngine on
          RewriteRule ^/(.*)?$ http://localhost:8000/$1 [P,L]
          

          The node app is running on port 8000 and responds to curl, but the rule doesn't seem to pull it up from a browser, only the default lamp index or a 404 if I drop the '^/'.

          Anyone else have this as a working example?

          See lamp.demo.cloudron.io

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

          @robi Apparently, P is an alternate way of ProxyPass . I think the lamp app does not proxy module enabled.

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

            Works now after enabling the module.

            image.png

            1 Reply Last reply
            0
            • girishG girish moved this topic from App Packaging & Development on
            • girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #5

              I pushed a new package that enables the proxy module.

              robiR 2 Replies Last reply
              3
              • girishG girish

                I pushed a new package that enables the proxy module.

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

                @girish Thank you!

                Conscious tech

                1 Reply Last reply
                0
                • robiR Offline
                  robiR Offline
                  robi
                  wrote on last edited by robi
                  #7

                  Hmm, @girish did you push a custom package?

                  image.png

                  After updating the LAMP app on my server, it still doesn't proxy properly via .htaccess file.

                  My version:
                  afd98b67-4f7b-49cd-8eb2-10fc4e310517-image.png

                  Conscious tech

                  girishG 1 Reply Last reply
                  0
                  • girishG girish

                    I pushed a new package that enables the proxy module.

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

                    @girish the new lamp app does have the modules enabled, but still no go via .htaccess file.

                    root@080866d1-7701-4faf-bc28-d6d63dbf252b:/app/data/apache# apache2ctl -M | grep proxy
                     proxy_module (shared)
                     proxy_http_module (shared)
                    

                    Oh I see; you added the proxypass block in the apache/app.conf instead.

                        <Location "/">
                        ProxyPass "http://localhost:8000"
                        </Location>
                    
                    

                    Not sure why .htaccess doesn't work as the rewrite_module is also loaded.

                    Conscious tech

                    girishG 1 Reply Last reply
                    0
                    • robiR robi

                      Hmm, @girish did you push a custom package?

                      image.png

                      After updating the LAMP app on my server, it still doesn't proxy properly via .htaccess file.

                      My version:
                      afd98b67-4f7b-49cd-8eb2-10fc4e310517-image.png

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

                      @robi said in How to run AI models in LAMP App:

                      Hmm, @girish did you push a custom package?

                      yes, I updated the demo app instance for testing before I published the package. you can just reinstall I guess.

                      1 Reply Last reply
                      0
                      • robiR robi

                        @girish the new lamp app does have the modules enabled, but still no go via .htaccess file.

                        root@080866d1-7701-4faf-bc28-d6d63dbf252b:/app/data/apache# apache2ctl -M | grep proxy
                         proxy_module (shared)
                         proxy_http_module (shared)
                        

                        Oh I see; you added the proxypass block in the apache/app.conf instead.

                            <Location "/">
                            ProxyPass "http://localhost:8000"
                            </Location>
                        
                        

                        Not sure why .htaccess doesn't work as the rewrite_module is also loaded.

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

                        @robi said in How to run AI models in LAMP App:

                        Not sure why .htaccess doesn't work as the rewrite_module is also loaded.

                        There is something wrong with that rule but I don't know htaccess configuration well enough. In fact, I wasn't aware of P before this. If you put RewriteRule "(.*)$" "http://localhost:8000/$1" [P,L] it does something (i.e a not found page from the node app atleast).

                        @robi said in How to run AI models in LAMP App:

                        RewriteRule ^/(.*)?$ http:/localhost:8000/$1 [P,L]

                        Also, there is a missing slash after http.

                        robiR 1 Reply Last reply
                        0
                        • robiR Offline
                          robiR Offline
                          robi
                          wrote on last edited by
                          #11

                          Good catch, however I don't have the same typo in my file.

                          I'll try a few more things and report back.

                          Conscious tech

                          1 Reply Last reply
                          0
                          • girishG girish

                            @robi said in How to run AI models in LAMP App:

                            Not sure why .htaccess doesn't work as the rewrite_module is also loaded.

                            There is something wrong with that rule but I don't know htaccess configuration well enough. In fact, I wasn't aware of P before this. If you put RewriteRule "(.*)$" "http://localhost:8000/$1" [P,L] it does something (i.e a not found page from the node app atleast).

                            @robi said in How to run AI models in LAMP App:

                            RewriteRule ^/(.*)?$ http:/localhost:8000/$1 [P,L]

                            Also, there is a missing slash after http.

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

                            @girish not sure why, but what did work for the bare domain was (.*)^

                            RewriteRule (.*)^ http://localhost:8000/$1 [P,L]
                            

                            There is also a /docs URL which then doesn't work, unless the ^ is missing.

                            RewriteRule (.*) http://localhost:8000/$1 [P,L]
                            

                            Conscious tech

                            1 Reply Last reply
                            1
                            • robiR robi referenced this topic on
                            • robiR Offline
                              robiR Offline
                              robi
                              wrote on last edited by robi
                              #13

                              If you don't care to use the proxy features in LAMP via Apache2, you can launch the App-Proxy app from the App Store and configure it on a new subdomain to proxy to any of the LAMP installed apps on local ports via the internal Cloudron IP, ie. http://172.18.xx.xxx:port (make sure to use HTTP and not HTTPS).

                              You can get the internal IP from the web terminal by typing hostname -i

                              Conscious tech

                              1 Reply Last reply
                              2
                              • robiR robi referenced this topic on
                              • robiR robi referenced this topic on
                              • robiR robi referenced this topic on
                              • robiR robi referenced this topic on
                              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