diff --git a/README.md b/README.md new file mode 100644 index 0000000..f0afda5 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Webservice automatic deployment on Hetzner Cloud + +## Getting started + +First you need to create a python virtual environment and activate it: +``` +python3 -m venv venv +source venv/bin/activate +``` + +Next you need to install required dependencies using pip: +``` +pip install hcloud +``` + +To deploy the webservice simply run the `deploy.py` script providing the token to Hetzner Cloud and ssh key as arguments: + +``` +python3 deploy.py +``` + +To remove the created servers run the `clean.py` script: + +``` +python3 clean.py +``` + +You can also use the `deploy.sh` script to run all above commands. +``` +chmod +x deploy.sh +./deploy.sh +``` \ No newline at end of file diff --git a/clean.py b/clean.py index d9aa781..be2d97f 100644 --- a/clean.py +++ b/clean.py @@ -8,7 +8,6 @@ subnet_name = prefix+"-webservice-subnet" server_name = prefix+"-webservice-server" load_balancer_name = prefix+"-webservice-loadbalancer" -public_key = sys.argv[2] token = sys.argv[1] server_count = 5 diff --git a/clean.sh b/clean.sh index 5d2d7f6..7ddedc9 100755 --- a/clean.sh +++ b/clean.sh @@ -1,3 +1,3 @@ #!/bin/bash source venv/bin/activate -python3 clean.py \ No newline at end of file +python3 clean.py "$1" \ No newline at end of file diff --git a/deploy.sh b/deploy.sh old mode 100644 new mode 100755 index c731fe0..c578190 --- a/deploy.sh +++ b/deploy.sh @@ -2,4 +2,4 @@ python3 -m venv venv source venv/bin/activate pip install hcloud -python3 deploy.py \ No newline at end of file +python3 deploy.py "$1" "$2" \ No newline at end of file