Skip to content

Commit

Permalink
fix: cloud-init script for hetzner
Browse files Browse the repository at this point in the history
  • Loading branch information
venkatamutyala committed Jan 6, 2025
1 parent b36c2ca commit 507a76c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/util/hetzner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ def multiline_to_singleline(input_text: str) -> str:
Returns:
str: Single-line string with `\\n` replacing newlines.
"""
return input_text.replace("\n", "\\n")
return input_text.replace("\n", "\n")


def create_instances(request):
captain_domain = request.captain_domain.strip()
credentials_for_chisel = util.chisel.generate_credentials()

# Define user data
user_data_readable = f"""#cloud-config
user_data_readable = f"""
#cloud-config
package_update: true
runcmd:
- curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh && sudo apt install tmux -y
- sudo docker run -d --restart always -p 9090:9090 -p 443:443 -p 80:80 -it jpillora/chisel:v1.10.1 server --reverse --port=9090 --auth='{credentials_for_chisel}'
- curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh && sudo apt install tmux -y
- sudo docker run -d --restart always -p 9090:9090 -p 443:443 -p 80:80 -it docker.io/jpillora/chisel:1.10.1 server --reverse --port=9090 --auth='{credentials_for_chisel}'
"""

user_data = multiline_to_singleline(user_data_readable)
Expand Down

0 comments on commit 507a76c

Please sign in to comment.