After spending two nights trying to get this working for myself and trying to wrap my head around docker, this seems to be the simplest solution:
- Edit the Dockerfile and add following lines (in place of that one line that @beaylott suggested):
RUN git clone https://github.com/emoncms/sync.git /home/pi/sync
RUN chgrp www-data /home/pi
RUN chgrp -R www-data /home/pi/sync
RUN ln -s /var/www/html /var/www/emoncms
RUN ln -s /home/pi/sync/sync-module /var/www/emoncms/Modules/sync
The reason I decided to place it in /home/pi even though there is no pi user is because that is the default location for $HOMEDIR on which the sync depends and it will save one step of modifying the settings.php. The other reason was that putting in /root did not seem right and would require modifying access rights to /root.
- after you save the file, you will need to rebuild the container:
sudo docker-compose up -d --build
reload the webpage. At least use Ctrl+F5 if not close and reopen the tab.
Before you try to use Sync. Go to Setup->Administration and do Update&Check to update the database.
Follow the instructions on Sync git page on how to configure it.
Now comes the biggest caveat: I spend about 6 hours researching how to implement cron in docker. And although it is possible, it would over complicate things beyond simple instructions if implemented correctly. That leaves two options:
- if you are just trying to transfer data from emoncms.org and this a one time deal, you can run the download manually by getting into the container using
sudo docker exec -t -i emoncmsdocker_web_1 /bin/bash
Once in there you need to run
- if you want to do this on schedule, you can create a cron job on your host that executes that script inside the container. I have not done it myself but the crontab should look something like this
* * * * * docker run --rm emoncmsdocker_web_1 /home/pi/sync/emoncms-sync.sh
I hope that helps