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

    Trouble with MC v2 install on RPi 4

    Scheduled Pinned Locked Moved General Discussion
    12 Posts 2 Posters 632 Views 1 Watching
    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.
    • W Offline
      wint0178
      last edited by

      Here is a screenshot of the docker system running with influxdb, natsio, and mqtt. Maybe something is wrong here? This was taken immediately after a system restart without running and apps or commands prior.

      dockerimage.png

      jkandasaJ 1 Reply Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @wint0178
        last edited by

        @wint0178 What is the log do you see on the mycontroller container?

        docker logs mycontroller
        

        and what is the output of,

        docker ps -a
        

        This is where I get hung up, but I'm not sure if I have settings above here incorrect or if there is something wrong with the following install/run commands.

        Can you please elaborate? Does the terminal hung to return?

        W 5 Replies Last reply Reply Quote 0
        • W Offline
          wint0178 @jkandasa
          last edited by jkandasa

          @jkandasa the response to
          docker logs mycontroller
          is Error response from daemon: No such container: mycontroller and the response to
          docker ps -a
          is:

          CONTAINER ID   IMAGE                     COMMAND                  CREATED      STATUS      PORTS                                                                                  NAMES
          8db9b7cb067c   eclipse-mosquitto:1.6.9   "/docker-entrypoint.…"   5 days ago   Up 5 days   0.0.0.0:1883->1883/tcp, :::1883->1883/tcp, 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp   mc_mosquitto
          44cb484f6753   nats:2.2.2-alpine         "docker-entrypoint.s…"   5 days ago   Up 5 days   6222/tcp, 0.0.0.0:4222->4222/tcp, :::4222->4222/tcp, 8222/tcp                          mc_natsio
          5c81d7e95d1a   influxdb:1.8.4            "/entrypoint.sh infl…"   5 days ago   Up 5 days   0.0.0.0:8086->8086/tcp, :::8086->8086/tcp                                              mc_influxdb
          
          1 Reply Last reply Reply Quote 0
          • W Offline
            wint0178 @jkandasa
            last edited by

            @jkandasa I also checked the docker version as you asked and it is Docker version 26.0.2, build 3c863ff.

            You asked about my timezone, I am in US Central timezone, the same as Chicago.

            I assume if I uninstall docker to try and update it using the code you include in the documentation, as you suggested, that I will also need to reinstall influxdb, natsio, and mqtt. Is that correct?

            Finally, I am not familiar with vim, but I just installed it and will check it out. I'll keep you posted. Thank you for your help!

            1 Reply Last reply Reply Quote 0
            • W Offline
              wint0178 @jkandasa
              last edited by

              @jkandasa I opened the /opt/apps/mycontroller/mycontroller.yaml in vim and found it to reflect the changes that I had made in nano, so I made no other changes.

              1 Reply Last reply Reply Quote 0
              • W Offline
                wint0178 @jkandasa
                last edited by

                @jkandasa I was just messing with your install from executable binary instructions and I got the MC server running and can pull it up at localhost:8080. When I run docker ps -a I am still getting the same three services running: mqtt, influxdb, and natsio. Is this correct?

                1 Reply Last reply Reply Quote 0
                • W Offline
                  wint0178 @jkandasa
                  last edited by

                  @jkandasa the running server on localhost has a warning that the Metrics database is disabled. I assume this has to do with installing MC from the binary, but it feels like progress anyway.

                  jkandasaJ 1 Reply Last reply Reply Quote 0
                  • jkandasaJ Offline
                    jkandasa @wint0178
                    last edited by jkandasa

                    @wint0178 Thanks for the details
                    I see you have an trailing space after \ ("--env TZ="Asia/Kolkata" \ "), that leads restart command not found
                    I have updated your timezone and removed the extra space, can you please try the following command to start the MyController server?

                    go to your mycontroller directory(root of mc_home and location of mycontroller.yaml) and run the following command

                    docker run  --detach --name mycontroller \
                      --network mycontroller \
                      --publish 8080:8080 \
                      --publish 8443:8443 \
                      --publish 9443:9443 \
                      --volume $PWD/mc_home:/mc_home \
                      --volume $PWD/mycontroller.yaml:/app/mycontroller.yaml \
                      --env TZ="America/Chicago" \
                      --restart unless-stopped \
                      docker.io/mycontroller/server:2.0.0
                    

                    If it doesn't comes up please run the following command, I just removed the --detach(don't run on background) and added --rm (remove the container on termination)

                    docker run  --rm --name mycontroller \
                      --network mycontroller \
                      --publish 8080:8080 \
                      --publish 8443:8443 \
                      --publish 9443:9443 \
                      --volume $PWD/mc_home:/mc_home \
                      --volume $PWD/mycontroller.yaml:/app/mycontroller.yaml \
                      --env TZ="America/Chicago" \
                      --restart unless-stopped \
                      docker.io/mycontroller/server:2.0.0
                    

                    I assume if I uninstall docker to try and update it using the code you include in the documentation, as you suggested, that I will also need to reinstall influxdb, natsio, and mqtt. Is that correct?

                    Yes, In the docker just removes the containers and creates from fresh.

                    I was just messing with your install from executable binary instructions and I got the MC server running and can pull it up at localhost:8080. When I run docker ps -a I am still getting the same three services running: mqtt, influxdb, and natsio. Is this correct?

                    executable is different than the docker. It will not be come under docker ps command.
                    It executes directly on the host system.
                    I would recommend to use docker version of mycontroller, for the portability and maintainability

                    the running server on localhost has a warning that the Metrics database is disabled. I assume this has to do with installing MC from the binary, but it feels like progress anyway.

                    This is because, executable which is running on outside of docker network and can not resolve the hostname used inside docker. If you replace hostname of mc_natsio, mc_influxdb to localhost on your mycontroller.yaml [1] should work. However, I would recommend to try the docker version of mycontroller.

                    [1] - If you apply this change, it will not work on docker version of mycontroller

                    W 2 Replies Last reply Reply Quote 0
                    • W Offline
                      wint0178 @jkandasa
                      last edited by

                      @jkandasa said in Trouble with MC v2 install on RPi 4:

                      @wint0178 Thanks for the details
                      I see you have an trailing space after \ ("--env TZ="Asia/Kolkata" \ "), that leads restart command not found
                      I have updated your timezone and removed the extra space, can you please try the following command to start the MyController server?

                      Thank you so much! It looks like that single space was the issue, I had hoped it was something that simple and silly, but my knowledge is very limited and I don't think I would have figured that out. thanks again! I'll copy the full install instructions I wrote, the the changes you suggested, in a reply below.

                      1 Reply Last reply Reply Quote 1
                      • W Offline
                        wint0178 @jkandasa
                        last edited by wint0178

                        @jkandasa Here is the full set of my instructions that just worked.

                        Install Raspberry Pi OS 64-bit
                        Start and setup with necessary updates
                        Open Terminal and Web Browser
                        In Web BRowser, go to www.mycontroller.org, www.forum.mycontroller.org, and https://get.docker.com
                        In www.mycontroller.org, click on "Documentation" and navigate to "Install Docker"
                        In terminal activate root user by typing
                        sudo su

                        Install Docker
                        Begin installation of Docker by typing the following commands one at a time with enter after each
                        curl -fsSL https://get.docker.com -o install-docker.sh
                        cat install-docker.sh
                        sh install-docker.sh --dry-run
                        sh install-docker.sh

                        (this one may take a few minutes, wait for "root@raspberrypi:/# to reappear)
                        (change "admin" below if your root user name is different)
                        usermod -aG docker admin
                        systemctl enable docker.service
                        systemctl start docker.service
                        systemctl is-active docker.service
                        (should return "active")

                        Make MC Portable
                        So that you are able to move your server from location to location, you will need to setup a Docker network to manage the changing IP addresses
                        Enter the following in terminal:
                        docker network create mycontroller

                        Install InfluxDB
                        Follow the instructions under "Install InfluxDB" for installation within Docker at www.mycontroller.org
                        Enter the following text commands in terminal with enter after each.

                        (this one may take a few minutes, wait for "root@raspberrypi:/# to reappear)
                        mkdir -p /opt/apps/influxdb
                        cd /opt/apps/influxdb

                        docker run --rm influxdb:1.8.4 influxd config > influxdb.conf

                        Open File Manager and navigate to /opt/apps/influxdb/influxdb.conf, double click to open and verify that it has roughly 150 lines of text in it.

                        In Terminal type
                        nano /opt/apps/influxdb/influxdb.conf
                        (this should open the same file in terminal and allow you to edit it)

                        Using the up and down arrows, scroll down to the line that reads "[monitor]" and change the following from
                        store-enabled = true
                        to
                        store-enabled = false
                        press control-O followed by enter to save
                        press control-X to exit the nano editor

                        Enter the following into terminal
                        (to return to the highest level of the file directory)
                        cd /

                        (this one may take a few minutes, wait for "root@raspberrypi:/# to reappear)
                        mkdir -p /opt/apps/influxdb/influxdb_data
                        cd /opt/apps/influxdb

                        docker run --detach --name mc_influxdb \
                        --network mycontroller \
                        --publish 8086:8086 \
                        --volume $PWD/influxdb_data:/var/lib/influxdb \
                        --volume $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
                        --env TZ="America/Chicago" \
                        --restart unless-stopped \
                        influxdb:1.8.4

                        Verify that the influxdb container is running in docker with the following code in terminal
                        docker ps
                        (this should show a list of running containers, only influxdb should appear right now)

                        (For future reference)
                        To see the Docker logs type in the following
                        docker logs mc_influxdb
                        To stop the influxdb in docker typle
                        docker stop mc_influxdb
                        To restart the influxdb in docker type
                        docker restart mc_influxdb
                        To uninstall influxdb in docker type
                        docker stop mc_influxdb
                        docker rm mc_influxdb

                        Install natsio
                        At www.mycontroller.org go to "Install natsio" and follow the directions as follows
                        Type the following into Terminal
                        cd /

                        The following will cause the Pi to download a few different things and install them, it can take a few minutes.
                        docker run --detach --name mc_natsio \
                        --network mycontroller \
                        --publish 4222:4222 \
                        --env TZ="America/Chicago" \
                        --restart unless-stopped \
                        nats:2.2.2-alpine

                        Verify that the natsio container is running in docker with the following code in terminal
                        docker ps
                        (this should show a list of running containers, only influxdb and natsio should appear right now)

                        (For future reference)
                        To see docker logs type the following
                        docker logs mc_natsio
                        To stop natsio type
                        docker stop mc_natsio
                        To restart natsio type
                        docker restart mc_natsio
                        To uninstall natsio type
                        docker stop mc_natsio
                        docker rm mc_natsio

                        Install MQTT Broker in Docker
                        at www.mycontroller.org navigate to "Install Mosquitto MQTT Broker" and follow the instructions as follows

                        In terminal type the following commands to install the broker in docker
                        # create mosquitto.conf
                        mkdir -p /opt/apps/mosquitto
                        cd /opt/apps/mosquitto

                        cat << EOF > mosquitto.conf
                        allow_anonymous true
                        persistence false
                        persistence_location /mosquitto/data/
                        EOF

                        With the following, Pi will download some files which could take a little while.
                        mkdir -p /opt/apps/mosquitto
                        cd /opt/apps/mosquitto

                        docker run -d --name mc_mosquitto \
                        --network mycontroller \
                        --publish 1883:1883 \
                        --publish 9001:9001 \
                        --volume $PWD/mosquitto.conf:/mosquitto/config/mosquitto.conf \
                        --restart unless-stopped \
                        eclipse-mosquitto:1.6.9

                        Verify that the MQTT container is running in docker with the following code in terminal
                        docker ps
                        (this should show a list of running containers, influxdb, natsio, and MQTT should appear)

                        (For future reference)
                        To see docker logs type the followings
                        docker logs mc_mosquitto
                        To stop MQTT broker type
                        docker stop mc_mosquitto
                        To restart MQTT broker type
                        docker restart mc_mosquitto
                        To uninstall MQTT broker type
                        docker stop mc_mosquitto
                        docker rm mc_mosquitto

                        Installing MyController Server v2.0
                        AT www.mycontroller.org, navigate to "Install with container image" and follow the directions as follows
                        Return to the root directory by typing
                        cd /
                        into terminal

                        In terminal type the following commands to install MC v2
                        mkdir -p /opt/apps/mycontroller/mc_home
                        mkdir -p /opt/apps/mycontroller/mc_home/secure_share
                        mkdir -p /opt/apps/mycontroller/mc_home/insecure_share

                        Change your dirrectory and get the defaul yaml file
                        cd /opt/apps/mycontroller

                        curl https://raw.githubusercontent.com/mycontroller-org/backend/v2.0.0/resources/sample-docker-server.yaml \
                        --output mycontroller.yaml

                        Open the yaml file to edit in nano
                        nano /opt/apps/mycontroller/mycontroller.yaml

                        Like earlier, the nano command is a terminal-based text editor and you will see a file with many lines of text open in terminal.
                        At the top you should see a line that reads something like
                        "secret: 5a2f6ff25b0025aeae12ae096363b51a # !!! WARNING: CHANGE THIS SECRET !!!"
                        The alpha-numeric secret must be changed to anything with 1 to 32 characters, but remember what you pick.

                        Change the yaml file so the database for influxdb points to your machine's IP address as follows:

                        bus:
                        type: embedded
                        topic_prefix: mc_server
                        server_url: nats://mc_natsio:4222
                        insecure: false
                        connection_timeout: 10s

                        metric:
                        disabled: false
                        type: influxdb
                        uri: http://mc_influxdb:8086
                        token:
                        username:
                        password:
                        organization_name:
                        bucket_name: mycontroller
                        batch_size:
                        flush_interval: 5s
                        query_client_version:

                        click control-O to save followed by enter
                        click control-X to exit nano

                        Start your MyController Server by entering the following text into terminal:

                        docker run --detach --name mycontroller \
                        --network mycontroller \
                        --publish 8080:8080 \
                        --publish 8443:8443 \
                        --publish 9443:9443 \
                        --volume $PWD/mc_home:/mc_home \
                        --volume $PWD/mycontroller.yaml:/app/mycontroller.yaml \
                        --env TZ="America/Chicago" \
                        --restart unless-stopped \
                        docker.io/mycontroller/server:2.0.0
                        In your web browser, check to make sure your server is running by going to http://localhost:8080 (or http://<your_ip>:8080)

                        This should bring up a MyController login screen where your username AND password are both set to "admin"
                        Login to verify that it is working.

                        On system restart, if docker and contained services do not automatically resume, use the following commands in terminal
                        docker restart mc_influxdb
                        docker restart mc_natsio
                        docker restart mc_mosquitto
                        docker restart

                        jkandasaJ 1 Reply Last reply Reply Quote 1
                        • jkandasaJ Offline
                          jkandasa @wint0178
                          last edited by

                          Thanks @wint0178 !!
                          I will go through the installation documentation and sync with your update.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          0

                          Online

                          586

                          Users

                          529

                          Topics

                          3.4k

                          Posts
                          Copyright © 2015-2025 MyController.org | Contributors | Localization