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. Building custom app - authentication problem

Building custom app - authentication problem

Scheduled Pinned Locked Moved App Packaging & Development
33 Posts 5 Posters 2.7k Views 6 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.
  • BrutalBirdieB BrutalBirdie

    @ekevu123 could you share your full step by step process since this error alone is confusing where it originates from.

    You could also use script and scriptreplay to share your step by step shell.
    Or a tool / service like https://asciinema.org/

    E Offline
    E Offline
    ekevu123
    wrote on last edited by ekevu123
    #3

    Here is the Cloudron manifest file, private information erased:

    {
      "id": "LINK",
      "title": "Title",
      "version": "1.0.0",
        "manifestVersion": 1,
      "description": "Description",
      "author": "author",
      "dockerImage": "link-to-image:tag",
      "healthCheckPath": "/",
      "httpPort": 80,
      "addons": {
        "localstorage": {},
        "mysql": {}
      }
    }
    
    

    Here is the docker file:

    FROM python:latest
    
    # Set the working directory to /app
    WORKDIR /app
    
    # Copy the requirements file into the container at /app
    COPY . /app/
    
    # Install any needed packages specified in requirements.txt
    RUN pip install -r requirements.txt
    RUN pip install gunicorn
    
    
    # Expose port 8000 for the Django application
    EXPOSE 8000
    
    # Set the environment variable for Django to run in production mode
    ENV DJANGO_SETTINGS_MODULE=demo.settings
    RUN python3 manage.py collectstatic
    
    # Run Django with Gunicorn
    CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
    #CMD ["gunicorn", "--bind", "0.0.0.0:8000", "demo.wsgi","--static-map /static=app/static"]
    

    I also have a requirements file with python packages.

    I have installed Cloudron CLI and run

    cloudron build
    

    on my local machine in the relevant folder.

    That's when the error occurs when the requirements from Python need to be downloaded. All other steps run normally in the process.

    BrutalBirdieB 1 Reply Last reply
    0
    • E ekevu123

      Here is the Cloudron manifest file, private information erased:

      {
        "id": "LINK",
        "title": "Title",
        "version": "1.0.0",
          "manifestVersion": 1,
        "description": "Description",
        "author": "author",
        "dockerImage": "link-to-image:tag",
        "healthCheckPath": "/",
        "httpPort": 80,
        "addons": {
          "localstorage": {},
          "mysql": {}
        }
      }
      
      

      Here is the docker file:

      FROM python:latest
      
      # Set the working directory to /app
      WORKDIR /app
      
      # Copy the requirements file into the container at /app
      COPY . /app/
      
      # Install any needed packages specified in requirements.txt
      RUN pip install -r requirements.txt
      RUN pip install gunicorn
      
      
      # Expose port 8000 for the Django application
      EXPOSE 8000
      
      # Set the environment variable for Django to run in production mode
      ENV DJANGO_SETTINGS_MODULE=demo.settings
      RUN python3 manage.py collectstatic
      
      # Run Django with Gunicorn
      CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
      #CMD ["gunicorn", "--bind", "0.0.0.0:8000", "demo.wsgi","--static-map /static=app/static"]
      

      I also have a requirements file with python packages.

      I have installed Cloudron CLI and run

      cloudron build
      

      on my local machine in the relevant folder.

      That's when the error occurs when the requirements from Python need to be downloaded. All other steps run normally in the process.

      BrutalBirdieB Offline
      BrutalBirdieB Offline
      BrutalBirdie
      Partner
      wrote on last edited by BrutalBirdie
      #4

      @ekevu123
      Regarding the Dockerfile:
      FROM python:latest all Cloudron apps relay on the cloudron/base image.
      Please use that image instead.

      Example:
      cloudron/base:4.0.0@sha256:31b195ed0662bdb06a6e8a5ddbedb6f191ce92e8bee04c03fb02dd4e9d0286df

      More pointers:

      • all app code should be stored in /app/code
      • EXPOSE 8000 - not needed since you define that in the CloudronManifest.json with "httpPort": 8000
      • manifestVersion is wrong see => https://docs.cloudron.io/packaging/manifest/#manifestversion should be value 2
      FROM cloudron/base:4.0.0@sha256:31b195ed0662bdb06a6e8a5ddbedb6f191ce92e8bee04c03fb02dd4e9d0286df
      
      # Set the working directory to /app
      WORKDIR /app/code/
      
      # Set the environment variable for Django to run in production mode (note: move all static stuff to the top so if you change stuff later on it has las layers to rebuild)
      ENV DJANGO_SETTINGS_MODULE=demo.settings
      
      # Copy the requirements file into the container at /app
      COPY . /app/code/
      
      # Install any needed packages specified in requirements.txt (Note from me: put into one layer 
      RUN pip install -r requirements.txt && \
          pip install gunicorn && \
          python3 manage.py collectstatic
      
      # Run Django with Gunicorn
      CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
      
      

      The CloudronManifest.json

      {
        "id": "LINK",
        "title": "Title",
        "version": "1.0.0",
        "manifestVersion": 2,
        "description": "Description",
        "author": "author",
        "dockerImage": "link-to-image:tag",
        "healthCheckPath": "/",
        "httpPort": 80,
        "addons": {
          "localstorage": {},
          "mysql": {}
        }
      }
      

      Can you try to build like this?

      Also see the docs about the Manifest what is required and what is optional, so you can limit the errors in that file for first testing builds.

      Like my work? Consider donating a drink. Cheers!

      timconsidineT 1 Reply Last reply
      2
      • E Offline
        E Offline
        ekevu123
        wrote on last edited by
        #5

        @BrutalBirdie Thank you for your help on this! I tried to follow your suggestions, but I am still getting this result during "cloudron build":

        WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa11a308b80>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/asgiref/
        

        Here is what I have changed:

        • changed Manifest version to 2
        • removed add-ons

        And I tried to run the Dockerfile as you suggested.

        1 Reply Last reply
        0
        • BrutalBirdieB Offline
          BrutalBirdieB Offline
          BrutalBirdie
          Partner
          wrote on last edited by
          #6

          This reads like a python error. Strange.

          Can you share your git repo so I can have a look and comment further?

          Since I am missing files I can not fully test it.

          asciicast

          Like my work? Consider donating a drink. Cheers!

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

            To isolate further, I would test docker build -t username/customimage . I think this is a docker error, possible some local DNS issue with Docker.

            1 Reply Last reply
            0
            • girishG girish moved this topic from Support on
            • E Offline
              E Offline
              ekevu123
              wrote on last edited by
              #8

              I got in touch via support to discuss this further! I tried a few tweaks myself, but I always run into the same mistake.

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

                @ekevu123 Maybe we continue here, it's not a problem (for us atleast). Can you tell us what issue you are facing when trying to build the image ?

                For a start, let's ignore the Cloudron aspects and just try to build the docker image. Are you able to docker build -t your_username/customimage . ? What is the output ?

                1 Reply Last reply
                0
                • BrutalBirdieB BrutalBirdie

                  @ekevu123
                  Regarding the Dockerfile:
                  FROM python:latest all Cloudron apps relay on the cloudron/base image.
                  Please use that image instead.

                  Example:
                  cloudron/base:4.0.0@sha256:31b195ed0662bdb06a6e8a5ddbedb6f191ce92e8bee04c03fb02dd4e9d0286df

                  More pointers:

                  • all app code should be stored in /app/code
                  • EXPOSE 8000 - not needed since you define that in the CloudronManifest.json with "httpPort": 8000
                  • manifestVersion is wrong see => https://docs.cloudron.io/packaging/manifest/#manifestversion should be value 2
                  FROM cloudron/base:4.0.0@sha256:31b195ed0662bdb06a6e8a5ddbedb6f191ce92e8bee04c03fb02dd4e9d0286df
                  
                  # Set the working directory to /app
                  WORKDIR /app/code/
                  
                  # Set the environment variable for Django to run in production mode (note: move all static stuff to the top so if you change stuff later on it has las layers to rebuild)
                  ENV DJANGO_SETTINGS_MODULE=demo.settings
                  
                  # Copy the requirements file into the container at /app
                  COPY . /app/code/
                  
                  # Install any needed packages specified in requirements.txt (Note from me: put into one layer 
                  RUN pip install -r requirements.txt && \
                      pip install gunicorn && \
                      python3 manage.py collectstatic
                  
                  # Run Django with Gunicorn
                  CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
                  
                  

                  The CloudronManifest.json

                  {
                    "id": "LINK",
                    "title": "Title",
                    "version": "1.0.0",
                    "manifestVersion": 2,
                    "description": "Description",
                    "author": "author",
                    "dockerImage": "link-to-image:tag",
                    "healthCheckPath": "/",
                    "httpPort": 80,
                    "addons": {
                      "localstorage": {},
                      "mysql": {}
                    }
                  }
                  

                  Can you try to build like this?

                  Also see the docs about the Manifest what is required and what is optional, so you can limit the errors in that file for first testing builds.

                  timconsidineT Offline
                  timconsidineT Offline
                  timconsidine
                  App Dev
                  wrote on last edited by
                  #10

                  @BrutalBirdie said in Building custom app - authentication problem:

                  "dockerImage": "link-to-image:tag",

                  For my education, is this line needed in the manifest file? because we are building the Dockerfile to produce an image.
                  I've never used this line when building a custom package

                  girishG 1 Reply Last reply
                  0
                  • timconsidineT timconsidine

                    @BrutalBirdie said in Building custom app - authentication problem:

                    "dockerImage": "link-to-image:tag",

                    For my education, is this line needed in the manifest file? because we are building the Dockerfile to produce an image.
                    I've never used this line when building a custom package

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

                    @timconsidine right, that line is not needed and not correct. One shouldn't specify a static docker image in the manifest.

                    1 Reply Last reply
                    1
                    • E Offline
                      E Offline
                      ekevu123
                      wrote on last edited by
                      #12

                      We can continue here, I just thought if I am supposed to share more personal information like repo access, then we can do this privately. But alright, I appreciate the help I am getting here!

                      Regarding the questions above:

                      1. I have removed the link to the docker image from the Cloudron manifest and tried to run "cloudron build" again, which gets me stuck here again:
                        Step 4/6 : RUN pip install --no-cache-dir -r requirements.txt
                        ---> Running in e834d414ac34

                      2. Now I am trying to build the docker image without Cloudron, see above, and I am getting the same issue.

                      The requirements file I am getting stuck with looks like this:
                      asgiref==3.6.0
                      beautifulsoup4==4.12.2
                      certifi==2022.12.7
                      (and more following)

                      It doesn't help to simply delete a few requirements, it will always hang with the first one in the file.

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

                        @ekevu123 yes, no worries 🙂 Just wanted to continue here since so far it's mostly something docker related and not cloudron related as such.

                        It seems this is a general Docker building issue. So, much depends on your platform / OS as well. Is this a Mac or Windows or Linux ?

                        Usually, the best way to debug Docker build issues is something like:

                        • First run, docker run -ti cloudron/base:4.0.0 /bin/bash . This will give you a bash prompt.
                        • Now, execute the commands in your Dockerfile one by one in the prompt and see where it breaks.
                        timconsidineT 1 Reply Last reply
                        1
                        • girishG girish

                          @ekevu123 yes, no worries 🙂 Just wanted to continue here since so far it's mostly something docker related and not cloudron related as such.

                          It seems this is a general Docker building issue. So, much depends on your platform / OS as well. Is this a Mac or Windows or Linux ?

                          Usually, the best way to debug Docker build issues is something like:

                          • First run, docker run -ti cloudron/base:4.0.0 /bin/bash . This will give you a bash prompt.
                          • Now, execute the commands in your Dockerfile one by one in the prompt and see where it breaks.
                          timconsidineT Offline
                          timconsidineT Offline
                          timconsidine
                          App Dev
                          wrote on last edited by
                          #14

                          @girish said in Building custom app - authentication problem:

                          Usually, the best way to debug Docker build issues is something like:

                          that's a cool "trick"

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            ekevu123
                            wrote on last edited by
                            #15

                            I know where it breaks, when downloading the python requirements. But I found the issue - apparently, you can not do that when being on VPN.

                            Now I get this error message in the end:
                            error parsing HTTP 403 response body: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
                            Failed to push image (are you logged in? if not, use "docker login")

                            However, I am logged in (I ran "docker login" right before executing "cloudron build").

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

                              @ekevu123 That's good progress! Not sure where you are pushing to, did you set the right image name ? You can try cloudron build --set-repository. Here, you should enter something like ekevu123/appname (where ekevu123 is your docker hub username and appname is the repository).

                              1 Reply Last reply
                              0
                              • E Offline
                                E Offline
                                ekevu123
                                wrote on last edited by
                                #17

                                Thank you very much, we are getting somewhere!

                                I got to run "cloudron install --image" after building the docker successfully. But I ran into another particular problem.

                                Firstly, when running the command, I got this error message:
                                App installation error: Installation failed: Unable to pull image PATH. message: (HTTP code 404) unexpected - pull access denied for PATH, repository does not exist or may require 'docker login': denied: requested access to the resource is denied statusCode: 404

                                So, I made sure I was logged in.

                                Secondly, I tried to run the command again and got this:
                                Failed to install app: 409 message: primary location 'PATH' is in use
                                (I could probably just specify a new path, it's not critical, but to keep it clean it would be great to know how to delete the failed attempt)

                                However, the Cloudron dashboard doesnt load anymore. It stays grey. If I try to log in in another browser, I get to the login mask, after putting in my details, I just see a grey screen. Fortunately, apps seem to work still, I can access them separately.

                                Independently of the actual docker error, that is an odd behaviour. I'll try to go through the tutorial for how to save cloudron next unless I see something specific in this thread.

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

                                  Then for a start lets get your Cloudron itself working. Do you see any errors in the browser logs or at /home/yellowtent/platformdata/logs/box.log ?

                                  1 Reply Last reply
                                  0
                                  • E Offline
                                    E Offline
                                    ekevu123
                                    wrote on last edited by
                                    #19

                                    The "unresponsive" app is new, perhaps that could cause it?
                                    The 3 stopped apps are okay, that's intended.

                                    2023-05-12T11:46:30.103Z box:apphealthmonitor app health: 3 running / 3 stopped / 1 unresponsive

                                    1 Reply Last reply
                                    0
                                    • E Offline
                                      E Offline
                                      ekevu123
                                      wrote on last edited by ekevu123
                                      #20

                                      My idea was now to use
                                      "cloudron stop --app NAME"
                                      using Cloudron CLI

                                      but it says
                                      "Failed to stop app: 409 message: Not allowed in error state"

                                      But this worked:
                                      "cloudron uninstall --app NAME"

                                      So, I got access to the dashboard again.

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

                                        hm so the app was in error state and thus stopping it was blocked, that is to be expected. However it should certainly not bring down the whole dashboard.

                                        1 Reply Last reply
                                        1
                                        • E Offline
                                          E Offline
                                          ekevu123
                                          wrote on last edited by
                                          #22

                                          Yep, I agree, but it did - and uninstalling the app via CLI immediately solved it.

                                          timconsidineT 1 Reply Last reply
                                          0
                                          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