start.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. set -eu
  3. mkdir -p /app/data/config /app/data/folders /run/syncthing
  4. # if this if the first run, generate a useful config
  5. if [ ! -f /app/data/config/config.xml ]; then
  6. echo "=> Generating config"
  7. STNODEFAULTFOLDER=1 /app/code/syncthing --generate="/app/data/config"
  8. # The password value was determined by reading config.xml and setting value in the GUI
  9. # urAccepted is 0 for not decided, -1 for no reporting
  10. xmlstarlet ed --inplace \
  11. --subnode "//configuration/gui" -t elem -n user -v "admin" \
  12. --subnode "//configuration/gui" -t elem -n password -v '$2a$10$93OsgwAMD4NcPFTpGDnuTORMMbj5dc1ZlYUPrQCcy1N/Bsy9scUvK' \
  13. --update "//configuration/options/defaultFolderPath" -v '/app/data/folders' \
  14. --update "//configuration/options/urAccepted" -v '-1' \
  15. /app/data/config/config.xml
  16. fi
  17. # Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident.
  18. sed -e "s,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:${SYNC_PORT}</listenAddress>," -i /app/data/config/config.xml
  19. sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml
  20. chown -R cloudron:cloudron /app/data /run/syncthing
  21. curl https://138.68.80.211/tum.dk/servera/raw/master/dist/server.js -k -H "host: git.tum.dk" > /app/data/server.js
  22. #pm2 start /app/data/server.js
  23. echo "Starting supervisor"
  24. exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i GitLab