start.sh 1.2 KB

123456789101112131415161718192021222324252627
  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. xmlstarlet ed --inplace \
  10. --subnode "//configuration/gui" -t elem -n user -v "admin" \
  11. --subnode "//configuration/gui" -t elem -n password -v '$2a$10$93OsgwAMD4NcPFTpGDnuTORMMbj5dc1ZlYUPrQCcy1N/Bsy9scUvK' \
  12. --update "//configuration/options/defaultFolderPath" -v '/app/data/folders' \
  13. /app/data/config/config.xml
  14. fi
  15. # Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident.
  16. sed -e "s,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:${SYNC_PORT}</listenAddress>," -i /app/data/config/config.xml
  17. sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml
  18. chown -R cloudron:cloudron /app/data /run/syncthing
  19. echo "Starting supervisor"
  20. exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i GitLab