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
  • Brite
  • 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 - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. Test new cloudron packages locally before on a live server.

Test new cloudron packages locally before on a live server.

Scheduled Pinned Locked Moved App Packaging & Development
cloudronmanifestnewbie
3 Posts 3 Posters 1.4k Views 3 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.
  • GrienauerG Offline
    GrienauerG Offline
    Grienauer
    wrote on last edited by
    #1

    Is there an option to test a cloudron app package locally e.g. on my dev computer (an apple MacBook) before installing it on a real server?
    I did my first cloudronManifest and just want to test it locally before I install it on a real live machine, where nothing should crash 😜

    due to the fact it is my first packaging, there will be errors and I would feel more save if I can test it beforehand 🙂

    Drupal CMS and Open Source Expert, Mautic Community lead Secretary

    murgeroM BrutalBirdieB 2 Replies Last reply
    0
    • GrienauerG Grienauer

      Is there an option to test a cloudron app package locally e.g. on my dev computer (an apple MacBook) before installing it on a real server?
      I did my first cloudronManifest and just want to test it locally before I install it on a real live machine, where nothing should crash 😜

      due to the fact it is my first packaging, there will be errors and I would feel more save if I can test it beforehand 🙂

      murgeroM Offline
      murgeroM Offline
      murgero
      App Dev
      wrote on last edited by
      #2

      @grienauer Spin up a VPS something cheap will work fine and use that - just needs a domain which you can get for cheap too

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

      1 Reply Last reply
      1
      • GrienauerG Grienauer

        Is there an option to test a cloudron app package locally e.g. on my dev computer (an apple MacBook) before installing it on a real server?
        I did my first cloudronManifest and just want to test it locally before I install it on a real live machine, where nothing should crash 😜

        due to the fact it is my first packaging, there will be errors and I would feel more save if I can test it beforehand 🙂

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

        @grienauer
        When I did my testing for the Valheim Server App I wrote this script to make testing easier.

        Note tho, this only works when not using any addons, but localstorage works with the local mount.

        #!/bin/bash
        
        # Function to get the user to input the needed vars
        get_vars () {
            read -p "Cloudron E-Mail: " EMAIL
            read -p "Cloudron Username: " USERNAME
            read -s -p "Cloudron Password: " PASSWORD
            read -p "Cloudron URL: " CLOUDRON_URL
            read -p "DOCKER REPOSITORY URL: " DOCKER_REPOSITORY_URL
            read -p "DOCKER USERNAME: " DOCKER_REPOSITORY_USERNAME
            read -p -s "DOCKER PASSWORD: " DOCKER_REPOSITORY_PASSWORD
        
        
            printf "EMAIL=$EMAIL\n
                    USERNAME=$USERNAME\n
                    PASSWORD=$PASSWORD\n
                    CLOUDRON_URL=$CLOUDRON_URL\n
                    DOCKER_REPOSITORY_URL=$DOCKER_REPOSITORY_URL\n
                    DOCKER_REPOSITORY_USERNAME=$DOCKER_REPOSITORY_USERNAME\n
                    DOCKER_REPOSITORY_PASSWORD=$DOCKER_REPOSITORY_PASSWORD\n
                    " > .env
        }
        
        # check if .env file exists and read it or check if vars exsist
        if [ -f ".env" ]; then
            export $(egrep -v '^#' .env | xargs) &> /dev/null
        else
            echo ".env File missing - asking for required vars"
            get_vars
        fi
        
        if [ -z "$EMAIL" ] || [ -z "$USERNAME" ] || [ -z "$PASSWORD" ] || [ -z "$CLOUDRON_URL" ] || [ -z "$DOCKER_REPOSITORY_URL" ] || [ -z "$DOCKER_REPOSITORY_USERNAME" ] || [ -z "$DOCKER_REPOSITORY_PASSWORD" ]; then
            echo "some vars are empty - asking for required vars"
            get_vars
        fi
        
        echo "=> Login Docker"
        docker login --username $DOCKER_REPOSITORY_USERNAME --password $DOCKER_REPOSITORY_PASSWORD $DOCKER_REPOSITORY_URL
        echo "=> Login Cloudron"
        cloudron login --username $USERNAME --password $PASSWORD my.$CLOUDRON_URL
        
        set -x
        
        # Get the ID and VERSION from the CloudronManifest.json
        ID=$(jq -r ".id" CloudronManifest.json)
        VERSION=$(jq -r ".version" CloudronManifest.json)
        
        echo "=> Create Test Data dir"
        mkdir -p ./cloudron_test/data ./cloudron_test/tmp ./cloudron_test/run
        
        echo "=> Cleanup Test Data"
        rm -rf ./cloudron_test/data/* ./cloudron_test/tmp/* ./cloudron_test/run/*
        
        echo "=> Build test image"
        cloudron build --set-repository $DOCKER_REPOSITORY_URL/$ID
        # docker build -t $DOCKER_REPOSITORY_URL/$ID:$VERSION .
        
        if [[ RUN_IMG = "" ]]; then
            read -p "Do you want to run the image created image?: (y/N)" RUN_IMG
        fi
        
        if [[ "$RUN_IMG" = "y" || "$RUN_IMG" = "Y" ]]; then
        echo "=> Run `test` tag of build image"
        docker run -ti --read-only \
            --volume $(pwd)/cloudron_test/data:/app/data:rw \
            --volume $(pwd)/cloudron_test/tmp:/tmp:rw \
            --volume $(pwd)/cloudron_test/run:/run:rw \
            $DOCKER_REPOSITORY_URL/$ID:$VERSION \
            bash
        fi
        
        echo "=> Running tests"
        cd test
        echo "=> Running ncu - updating deps"
        ncu -u
        npm -i
        echo "=> Installing package.json"
        npm install
        if [[ -f ./node_modules/.bin/mocha ]]; then
            ./node_modules/.bin/mocha ./test.js -b
        fi
        
        if [[ -f ../node_modules/.bin/mocha ]]; then
            ../node_modules/.bin/mocha ./test.js -b
        fi
        
        # remove installed test instance
        echo "Cancel now if you wish to keep the app installed"
        sleep 10
        cloudron uninstall --app test.$CLOUDRON_URL
        

        Like my work? Consider donating a drink. Cheers!

        1 Reply Last reply
        2

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        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