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


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Custom Lamp App Cloudron Build Error

    App Packaging & Development
    5
    15
    764
    Loading More Posts
    • 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.
    • Shai
      Shai last edited by

      I'm following these instructions for building a custom app modeled off of the Lamp app but which allows multiple databases. I'm following these instructions. When I run cloudron build --local, after I put in my docker hub repository path, it gets most of the way through the build but then borks with the following error

      The command '/bin/bash -c apt-get -y update && apt install -y cron apache2-dev php-imagick && rm -rf /var/cache/apt /var/lib/apt/lists' returned a non-zero code: 100
      

      I'm stuck. Help appreciated.

      murgero girish 2 Replies Last reply Reply Quote 0
      • murgero
        murgero App Dev @Shai last edited by

        @shai said in Custom Lamp App Cloudron Build Error:

        returned a non-zero code: 100

        Try doing RUN apt-get update -y && apt install apt-transport-https -y in the docker file towards the top.

        --
        https://urgero.org
        ~ Professional Nerd. Freelance Programmer. ~
        Matrix: @murgero:urgero.org

        1 Reply Last reply Reply Quote 0
        • girish
          girish Staff @Shai last edited by

          @shai Can you paste the fill docker build output and the Dockerfile as well. Usually, what you can do is that there will be an "image" hash right before this command fails. You can then "docker run -ti <imagehash> /bin/bash" and then you can run the command that fails to see why it's failing. I wonder if the issue here is that you have some network connectivity issue from inside docker containers.

          Shai 1 Reply Last reply Reply Quote 0
          • Shai
            Shai @girish last edited by

            @girish

            Thanks. I don't see an image hash. Rather it fails on a GPG key.

            Here is the build output

            Step 1/26 : FROM cloudron/base:2.0.0@sha256:f9fea80513aa7c92fe2e7bf3978b54c8ac5222f47a9a32a7f8833edf0eb5a4f4
             ---> afa4cfc125b4
            Step 2/26 : RUN mkdir -p /app/code
             ---> Using cache
             ---> e07f49f6451d
            Step 3/26 : WORKDIR /app/code
             ---> Using cache
             ---> 97eeefe5d9eb
            Step 4/26 : RUN apt-get -y update && apt install -y cron apache2-dev php-imagick && rm -rf /var/cache/apt /var/lib/apt/lists
             ---> Running in a5881c83ada4
            Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
            Get:2 http://dl.yarnpkg.com/debian stable InRelease [17.1 kB]
            Get:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease [20.8 kB]
            Get:4 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
            Err:2 http://dl.yarnpkg.com/debian stable InRelease
              The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
            Get:5 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1421 kB]
            Get:6 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [510 kB]
            Get:7 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2263 kB]
            Get:8 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [26.7 kB]
            Get:9 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
            Get:10 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages [158 kB]
            Get:11 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
            Get:12 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
            Get:13 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
            Get:14 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
            Get:15 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
            Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [39.4 kB]
            Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [544 kB]
            Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2699 kB]
            Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2196 kB]
            Get:20 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [11.3 kB]
            Get:21 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [11.4 kB]
            Reading package lists...
            W: GPG error: http://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
            E: The repository 'http://dl.yarnpkg.com/debian stable InRelease' is not signed.
            The command '/bin/bash -c apt-get -y update && apt install -y cron apache2-dev php-imagick && rm -rf /var/cache/apt /var/lib/apt/lists' returned a non-zero code: 100
            

            Here is the docker file:

            FROM cloudron/base:2.0.0@sha256:f9fea80513aa7c92fe2e7bf3978b54c8ac5222f47a9a32a7f8833edf0eb5a4f4
            
            RUN mkdir -p /app/code
            WORKDIR /app/code
            
            # required for compiling rpaf
            RUN apt-get -y update && apt install -y cron apache2-dev php-imagick && rm -rf /var/cache/apt /var/lib/apt/lists
            
            # configure apache
            RUN rm /etc/apache2/sites-enabled/*
            RUN sed -e 's,^ErrorLog.*,ErrorLog "|/bin/cat",' -i /etc/apache2/apache2.conf
            COPY apache/mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf
            COPY apache/lamp.conf /etc/apache2/sites-enabled/lamp.conf
            RUN echo "Listen 80" > /etc/apache2/ports.conf
            RUN a2disconf other-vhosts-access-log
            RUN a2enmod rewrite headers rewrite expires cache
            
            # configure mod_php
            RUN crudini --set /etc/php/7.3/apache2/php.ini PHP upload_max_filesize 64M && \
                crudini --set /etc/php/7.3/apache2/php.ini PHP post_max_size 64M && \
                crudini --set /etc/php/7.3/apache2/php.ini PHP memory_limit 128M && \
                crudini --set /etc/php/7.3/apache2/php.ini Session session.save_path /run/app/sessions && \
                crudini --set /etc/php/7.3/apache2/php.ini Session session.gc_probability 1 && \
                crudini --set /etc/php/7.3/apache2/php.ini Session session.gc_divisor 100
            
            RUN mv /etc/php/7.3/apache2/php.ini /etc/php/7.3/apache2/php.ini.orig && ln -sf /app/data/php.ini /etc/php/7.3/apache2/php.ini && \
                mv /etc/php/7.3/cli/php.ini /etc/php/7.3/cli/php.ini.orig && ln -sf /app/data/php.ini /etc/php/7.3/cli/php.ini
            
            # install RPAF module to override HTTPS, SERVER_PORT, HTTP_HOST based on reverse proxy headers
            # https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-web-server-and-reverse-proxy-for-apache-on-one-ubuntu-16-04-server
            RUN mkdir /app/code/rpaf && \
                curl -L https://github.com/gnif/mod_rpaf/tarball/669c3d2ba72228134ae5832c8cf908d11ecdd770 | tar -C /app/code/rpaf -xz --strip-components 1 -f -  && \
                cd /app/code/rpaf && \
                make && \
                make install && \
                rm -rf /app/code/rpaf
            
            # configure rpaf
            RUN echo "LoadModule rpaf_module /usr/lib/apache2/modules/mod_rpaf.so" > /etc/apache2/mods-available/rpaf.load && a2enmod rpaf
            
            # phpMyAdmin
            RUN mkdir -p /app/code/phpmyadmin && \
                curl -L https://files.phpmyadmin.net/phpMyAdmin/4.9.4/phpMyAdmin-4.9.4-all-languages.tar.gz | tar zxvf - -C /app/code/phpmyadmin --strip-components=1
            COPY phpmyadmin-config.inc.php /app/code/phpmyadmin/config.inc.php
            
            # configure cron
            RUN rm -rf /var/spool/cron && ln -s /run/cron /var/spool/cron
            # clear out the crontab
            RUN rm -f /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* && truncate -s0 /etc/crontab
            
            # ioncube. the extension dir comes from php -i | grep extension_dir
            # extension has to appear first, otherwise will error with "The Loader must appear as the first entry in the php.ini file"
            RUN mkdir /tmp/ioncube && \
                curl http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz | tar zxvf - -C /tmp/ioncube && \
                cp /tmp/ioncube/ioncube/ioncube_loader_lin_7.3.so /usr/lib/php/20170718 && \
                rm -rf /tmp/ioncube && \
                echo "zend_extension=/usr/lib/php/20170718/ioncube_loader_lin_7.3.so" > /etc/php/7.3/apache2/conf.d/00-ioncube.ini && \
                echo "zend_extension=/usr/lib/php/20170718/ioncube_loader_lin_7.3.so" > /etc/php/7.3/cli/conf.d/00-ioncube.ini
            
            # configure supervisor
            ADD supervisor/ /etc/supervisor/conf.d/
            RUN sed -e 's,^logfile=.*$,logfile=/run/supervisord.log,' -i /etc/supervisor/supervisord.conf
            
            # add code
            COPY start.sh index.php crontab.template credentials.template phpmyadmin_login.template /app/code/
            
            # lock www-data but allow su - www-data to work
            RUN passwd -l www-data && usermod --shell /bin/bash --home /app/data www-data
            
            # make cloudron exec sane
            WORKDIR /app/data
            
            CMD [ "/app/code/start.sh" ]
            
            
            murgero Shai 2 Replies Last reply Reply Quote 1
            • murgero
              murgero App Dev @Shai last edited by

              @shai said in Custom Lamp App Cloudron Build Error:

              FROM cloudron/base:2.0.0@sha256:f9fea80513aa7c92fe2e7bf3978b54c8ac5222f47a9a32a7f8833edf0eb5a4f4

              This is the hash, after the sha256 bit

              --
              https://urgero.org
              ~ Professional Nerd. Freelance Programmer. ~
              Matrix: @murgero:urgero.org

              1 Reply Last reply Reply Quote 0
              • Shai
                Shai @Shai last edited by

                @girish @murgero,

                The problem was the GPG key for yarn.

                By adding the following on line 5 of Dockerfile the problem was fixed:

                RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
                

                That line did generate the following warning; you tell me if it is of concern:

                Warning: apt-key output should not be parsed (stdout is not a terminal)
                

                I've successfully installed the app on my Cloudron. Now I'm configuring the two dbs.

                nebulon 1 Reply Last reply Reply Quote 1
                • nebulon
                  nebulon Staff @Shai last edited by

                  @shai ah we had this in the past indeed. One reason to update your custom package to the new base image v3:

                  FROM cloudron/base:3.0.0@sha256:455c70428723e3a823198c57472785437eb6eab082e79b3ff04ea584faf46e92
                  
                  Shai 1 Reply Last reply Reply Quote 3
                  • Shai
                    Shai @nebulon last edited by

                    @nebulon Great. Thanks. That info should be put into Multiple Databases with Lamp instructions.

                    nebulon 1 Reply Last reply Reply Quote 1
                    • nebulon
                      nebulon Staff @Shai last edited by

                      @shai looks like we have to update the mentioned app to base image 3 as well as php7.4 not sure what a good strategy here is, to better update those template apps. @girish do you have any other idea, besides just forking those git repos?

                      girish 1 Reply Last reply Reply Quote 0
                      • girish
                        girish Staff @nebulon last edited by

                        @nebulon I created a new repo with latest base image at https://git.cloudron.io/cloudron/lamp7.4-multidb-app

                        arshsahzad 1 Reply Last reply Reply Quote 0
                        • arshsahzad
                          arshsahzad @girish last edited by

                          @girish I have installed lamp7.4-multiDB-app in my cloudron server. When I'm trying to connect MySQL database using web terminal & Windows WSL Ubuntu 20.04. I'm getting an error in lamp7.4-multiDB-app.

                          #Web Terminal Error:
                          mysql: [Warning] Using a password on the command line interface can be insecure.
                          ERROR 2026 (HY000): SSL connection error: unknown error number
                          
                          #WSL Ubuntu 20.04 Error:
                          mysql: [Warning] Using a password on the command line interface can be insecure.
                          ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
                          
                          girish 1 Reply Last reply Reply Quote 0
                          • girish
                            girish Staff @arshsahzad last edited by

                            @arshsahzad Did you create the database after installing the app? You can create databases with a prefix of CLOUDRON_MYSQL_DATABASE_PREFIX . The "MySQL" button on top of the web terminal won't work immediately you have to replace the database name with the database you created previously. The MySQL button only works for single database apps. For multiple database apps, it doesn't know the name of the database.

                            arshsahzad 1 Reply Last reply Reply Quote 0
                            • arshsahzad
                              arshsahzad @girish last edited by

                              @girish said in Custom Lamp App Cloudron Build Error:

                              @arshsahzad Did you create the database after installing the app? You can create databases with a prefix of CLOUDRON_MYSQL_DATABASE_PREFIX . The "MySQL" button on top of the web terminal won't work immediately you have to replace the database name with the database you created previously. The MySQL button only works for single database apps. For multiple database apps, it doesn't know the name of the database.

                              I installed the LAMP MultiDB using WSL Ubuntu 20.04 to my cloudron server after login.

                              cloudron install --appstore-id lamp.cloudronapp
                              

                              then cloudron exec --app test.example.com, but when I'm trying

                              mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST}
                              

                              I'm getting the above-mentioned error, I don't know what to do next, I didn't created any database after installation because I'm not able to access the default created DB.

                              girish 1 Reply Last reply Reply Quote 0
                              • girish
                                girish Staff @arshsahzad last edited by

                                @arshsahzad said in Custom Lamp App Cloudron Build Error:

                                cloudron install --appstore-id lamp.cloudronapp

                                This seems incorrect. You have to cloudron build and then cloudron install. With --appstore-id you are trying to install an app from the Cloudron App Store and it's not installing the Lamp 7.4 MultiDB app you just built.

                                I tried this now and this works for me:

                                root@26925401-6b67-4c07-b4f8-81f4402572ed:/app/data# env | grep PREFIX
                                CLOUDRON_MYSQL_DATABASE_PREFIX=f6433359711935b8_
                                root@26925401-6b67-4c07-b4f8-81f4402572ed:/app/data# mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST}
                                mysql: [Warning] Using a password on the command line interface can be insecure.
                                Welcome to the MySQL monitor.  Commands end with ; or \g.
                                Your MySQL connection id is 18989
                                Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)
                                
                                Copyright (c) 2000, 2021, Oracle and/or its affiliates.
                                
                                Oracle is a registered trademark of Oracle Corporation and/or its
                                affiliates. Other names may be trademarks of their respective
                                owners.
                                
                                Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
                                
                                mysql> CREATE DATABASE f6433359711935b8_MyNewDatabase;
                                Query OK, 1 row affected (0.01 sec)
                                
                                mysql> 
                                

                                As seen above, I create arbitrary database with the prefix.

                                arshsahzad 1 Reply Last reply Reply Quote 0
                                • arshsahzad
                                  arshsahzad @girish last edited by

                                  @girish Now It's working, thanks for your help

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Powered by NodeBB