-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstance-startup.sh
28 lines (21 loc) · 922 Bytes
/
instance-startup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Set the metadata server to the get projct id
PROJECTID=$(curl -s "http://metadata.google.internal/computeMetadata/v1/project/project-id" -H "Metadata-Flavor: Google")
BUCKET=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/BUCKET" -H "Metadata-Flavor: Google")
echo "Project ID: ${PROJECTID} Bucket: ${BUCKET}"
# Get the files we need
gsutil cp gs://${BUCKET}/*.jar .
# Set current public IP to domain
IP=$(curl -s api.ipify.org)
gcloud dns record-sets update www.slippi-replay.store. \
--rrdatas=$IP \
--ttl=300 \
--type=A \
--zone=slippi-replay-store-zone
# Install dependencies
apt-get update
apt-get -y --force-yes install openjdk-11-jdk
# Make Java 11 default
update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/jre/bin/java
# Start server
authbind --deep java -jar -Dspring.profiles.active=prod slippi-replay-store-0.0.1-SNAPSHOT.jar