This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http-server.https.enabled=true | |
http-server.https.port=8443 | |
http-server.https.keystore.path=/etc/presto/prestocert.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure to modify this code to point to your actual domain. Also double-check the names of the certificates before running this. | |
# Lastly, be careful with su, but you already know that ;) | |
sudo su | |
cp -r /etc/letsencrypt/archive/yourdomain.com /etc/presto | |
cd /etc/presto | |
touch prestocert.pem | |
cat fullchain.pem >> prestocert.pem | |
cat privkey.pem >> prestocert.pem | |
chmod 644 prestocert.pem | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install snapd | |
sudo snap install core | |
sudo snap refresh core | |
sudo apt-get remove certbot | |
sudo snap install --classic certbot | |
sudo ln -s /snap/bin/certbot /usr/bin/certbot | |
sudo certbot --apache | |
#follow the prompts, specifying the domain you purchased as the one to be verified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
apt update | |
apt -y install apache2 | |
cat <<EOF > /var/www/html/index.html | |
<html><body><h1>Hello World</h1> | |
<p>This page was created from a startup script.</p> | |
</body></html> | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export REGION=us-central1 | |
export ZONE=us-central1-a | |
gcloud config set compute/zone ${ZONE} | |
export PROJECT=$(gcloud info --format='value(config.project)') | |
export WORKERS=5 | |
gcloud beta dataproc clusters create presto-cluster \ | |
--project=${PROJECT} \ | |
--region=${REGION} \ | |
--num-workers=${WORKERS} \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud builds submit --tag gcr.io/your-project-name/switchoff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the official lightweight Python image. | |
# https://hub.docker.com/_/python | |
FROM python:3.8-slim | |
# Install Curl | |
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install -y curl | |
# Downloading gcloud package | |
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from flask import Flask | |
from subprocess import Popen, PIPE | |
app = Flask(__name__) | |
@app.route('/') | |
def serve(): | |
# Replace the argument below with '/app/switchoff' in the switchoff directory!!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gcloud auth activate-service-account\ | |
--key-file\ | |
your-personal-keyfile.json # <-- Replace this with your personal GCP keyfile | |
#In the call below, replace [SERVICE_NAME] with the name of the App Engine service you wish to stop | |
gcloud -q app versions start $(gcloud app versions list --filter="traffic_split=1.00" --service=[SERVICE_NAME] --format="table(version.id)" | tail -n 1) --service=[SERVICE_NAME] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gcloud auth activate-service-account\ | |
--key-file\ | |
your-personal-keyfile.json # <-- Replace this with your personal GCP keyfile | |
#In the call below, replace [SERVICE_NAME] with the name of the App Engine service you wish to stop | |
gcloud -q app versions stop $(gcloud app versions list --filter="traffic_split=1.00" --service=[SERVICE_NAME] --format="table(version.id)" | tail -n 1) --service=[SERVICE_NAME] |