Moving Server to another location
-
Out of curiosity, what would it take to move MC v2 server running on RPi with docker, influxdb, nats.io and mqtt broker from work to home where it would have a different IP address? I would like to be able to do this while I'm working on it, but have already tried to do it by chaging the IP addresses for nats.io and MQTT in the mycontroller.yaml file along with a full restart to follow. That didn't work and gave a message that the container already existed so would need to be renamed or removed. I tried the $ docker -rm and $ docker rename, both seemed to work, but that didn't help.
Ultimately, It looks like that nats.io and mqtt are what is running and causing the problem since I ran $ docker ps and got the following:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4198c1f43976 eclipse-mosquitto:1.6.9 "/docker-entrypoint.…" 4 hours ago Up 12 minutes 0.0.0.0:1883->1883/tcp, :::1883->1883/tcp, 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp mc_mosquitto
b1a6893aebf1 nats:2.2.2-alpine "docker-entrypoint.s…" 4 hours ago Up 13 minutes 6222/tcp, 0.0.0.0:4222->4222/tcp, :::4222->4222/tcp, 8222/tcp mc_natsioI've tried going through the documentation and simply restarting each of the services, maybe that was a mistake?
I'll keep trying, but would love input about how to make this server portable so I can move it back and forth daily for now.
-
@wint0178 I would recommend to use
docker network
create a docker network in your rpi,docker network create mycontroller
and include the
--network=mycontroller
in all of your services, like mycontroller, influxdb, natsio, mqtt server, etc.,
and use name of the service in the place of IPs inmycontroller.yaml
Few sample:
docker run --detach --name mc_natsio \ --network mycontroller \ --publish 4222:4222 \ --env TZ="Asia/Kolkata" \ --restart unless-stopped \ nats:2.2.2-alpine
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="Asia/Kolkata" \ --restart unless-stopped \ docker.io/mycontroller/server:2.0.0
...omitted... bus: ...omitted... server_url: nats://mc_natsio:4222 metric: ...omitted... uri: http://influxdb:8086
-
@jkandasa this appears to have worked, but I am at work right now and will not have a chance to check at home until later today. I have influxdb, natsio, and mqtt all running in docker AND I have the network setup the way you described. Thank you for all of the help!
Once I started MC on my Pi the dashboard comes up, but I get the following message (or error) in the upper right corner:
Request failed with status code 401
URL: /api/datarepositoryMessage: {"success":false,"message":"401 Unauthorized","data":null}
Any idea what this is about? I am currently working on getting MySensor Gateways, nodes, and sensors hooked up, but have not made it very far into the process.
-
Once I started MC on my Pi the dashboard comes up, but I get the following message (or error) in the upper right corner:
Request failed with status code 401
URL: /api/datarepositoryDo you have anything in the dashboard referring data repository and it is not there in data repository?
Message: {"success":false,"message":"401 Unauthorized","data":null}
I think you existing login session and restarted the MyContorller, so leads this error and redirect to login page. but after login still it shows the previous error. I will try to remove that.
-
@jkandasa thanks for the help, I think the errors are gone now. I was able to move my RPi home and the MC server started up after booting the OS just like normal. This is wonderful!
As for the errors, perhaps they will reappear at work? Or maybe they are gone, not sure, but I will comment again later if they reappear.
As for the dashboard, there is nothing there. In v1.5 there was a clock and location, but not in v2.0. Is here a way to add those back?
-
@wint0178 said in Moving Server to another location:
As for the dashboard, there is nothing there. In v1.5 there was a clock and location, but not in v2.0. Is here a way to add those back?
No, for now in V2 we do not have clock and location.
-
@jkandasa do you expect this to change over time? Are you anticipating adding more features like v1.5 included to other users with various levels of access also?
-
@jkandasa I just moved my RPi from work to home today after following your instructions to setup a network within docker that will runinfluxdb, natsio, and mqtt. When I came home and initially rebooted the machine, I was able to log into my server at http:<ip_address>:8080 without trouble. I later decided to simply shutdown the machine using the terminal "shutdown: command and restart it. When I logged back into my server dashboard I got the following error message:
Request failed with status code 401
URL: /api/versionMessage: {"success":false,"message":"401 Unauthorized","data":null}
I'm not sure if this is related, but while I was initially running the machine, I plugged in an Ethernet cable and turned off WiFi for about two hours, then I decided to go back to WiFi, but the ip address was different between the two. I made the necessary changes in my Arduino sketch for the mqtt gateway and it worked, but the error message appeared. It may be nothing and may not cause any problems, or it may be due to the fact that I have no nodes or sensors actually hooked up yet, but I thought I'd add these details for you to take a look at.
-
yes, that's a message I get from time to time.
depending on which dashboard is loaded, the browser cache may be the problem?
-
-
@jkandasa I have fixed this. available in the docker container(
2.1.0-devel
). yet to update in executable.