Skip to content

Instantly share code, notes, and snippets.

@zziger
Last active January 27, 2024 22:31
Show Gist options
  • Save zziger/d2bfc5bd99fcd64e6d6b0a5ed326e251 to your computer and use it in GitHub Desktop.
Save zziger/d2bfc5bd99fcd64e6d6b0a5ed326e251 to your computer and use it in GitHub Desktop.
Screensy autosetup

Setup guide

  1. Create a new Primary IP in your Hetzner project, name it screenshare
  2. Forward the new IP to some domain (optionally)
  3. Add your SSH key to the project and name it main
  4. Navigate to Security -> API tokens in your Hetzner console, and generate a new Read & write token
  5. Install Hetzner CLI
  6. Execute hcloud context create yourname and enter your token
  7. Replace YOUR_DOMAIN in both files with your domain or IP
  • To start the service, run screenshare.sh. Once cloud-init finished log is there, you're ready to go. Keep in mind that service creates SSL certificate after startup, which might take a moment. Total startup time is around 2-3 minutes.
  • To stop the service, run stop.sh

Warning

This script creates a new CPX31 server on the current context's project. At the time of writing, that costs €0.026/hr.

#cloud-config
package_update: true
package_upgrade: true
runcmd:
- 'curl -fsSL https://get.docker.com | sudo sh'
- 'git clone https://github.com/screensy/screensy.git ~/screensy'
- 'sed -i "s/localhost {/YOUR_DOMAIN {/" ~/screensy/Caddyfile'
- 'cd ~/screensy && docker compose up -d'
hcloud server create --name screenshare --type cpx31 --image ubuntu-22.04 --without-ipv6 --primary-ipv4 screenshare --user-data-from-file init.yml --ssh-key main
sleep 10
ssh-keygen -R YOUR_DOMAIN
ssh -o StrictHostKeyChecking=no -t root@YOUR_DOMAIN 'tail -f -n 30 /var/log/cloud-init-output.log'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment