Created
November 10, 2017 22:51
-
-
Save mgahan/ebece4cc241888c37d8483e7db5505d4 to your computer and use it in GitHub Desktop.
OpenVPN Creation with Google Cloud
This file contains hidden or 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
# Create Ubuntu 16.04 instance to host openvpn | |
gcloud compute instances create openvpn-pritunl \ | |
--image-family ubuntu-1604-lts --image-project ubuntu-os-cloud \ | |
--zone us-west1-a \ | |
--network default \ | |
--tags https-server,http-server \ | |
--address vpn-static \ | |
--service-account [email protected] \ | |
--can-ip-forward | |
# SSH into server with gcloud console | |
################################ OpenVPN instructions ################################ | |
#https://gist.github.com/neuni/e10629ce704f5dc980d866902414bec1 | |
# Login as root | |
sudo su | |
cd /root | |
echo 'deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse' > /etc/apt/sources.list.d/mongodb-org-3.2.list | |
echo 'deb http://repo.pritunl.com/stable/apt xenial main' > /etc/apt/sources.list.d/pritunl.list | |
echo "[Unit]\nDescription=High-performance, schema-free document-oriented database\nAfter=network.target\n\n[Service]\nUser=mongodb\nExecStart=/usr/bin/mongod --config /etc/mongod.conf\n\n[Install]\nWantedBy=multi-user.target" > /lib/systemd/system/mongod.service | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 42F3E95A2C4F08279C4960ADD68FA50FEA312927 | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A | |
apt-get update | |
apt-get install pritunl mongodb-org | |
systemctl start pritunl mongod | |
systemctl enable pritunl mongod | |
# Collect setup key | |
pritunl setup-key | |
# Now navigate to your VMs external IP | |
# Created [https://www.googleapis.com/compute/v1/projects/metabiota-modeling/zones/us-west1-a/instances/openvpn-pritunl]. | |
# NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS | |
# openvpn-pritunl us-west1-a n1-standard-1 10.138.0.2 35.197.61.183 RUNNING | |
# Enter setup key from terminal | |
# After that is loaded, navigate to 35.197.61.183/login | |
# Enter default username and password | |
# Username: pritunl | |
# Password: pritunl | |
# Change initial setup to your username and password | |
# COnfiguration | |
#Open Users-Tab and add a new organization | |
# Organization: datascience | |
#Add a user to the new organization | |
#Open Servers-Tab and select "Add server" | |
# port should be udp:1194 | |
# Remove route 0.0.0.0/0 | |
# Add route 104.196.249.225/32 | |
# Attach organization | |
# Start server | |
###################################################################################### | |
gcloud beta compute firewall-rules create default-allow-rstudio --allow tcp:8787 --network default --priority 65535 --source-ranges 35.197.61.189/32 | |
gcloud beta compute firewall-rules create default-allow-shiny --allow tcp:3838 --network default --priority 65535 --source-ranges 35.197.61.189/32 | |
# Instructions to resize disk partition | |
# https://cloud.google.com/compute/docs/disks/add-persistent-disk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment