Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: starting script for online demo (#267)
Luke Zhou5132161960e1
diff --git a/Dockerfile b/Dockerfileindex 627f9175f5..3aca2bee6f 100644--- a/Dockerfile+++ b/Dockerfile@@ -63,6 +63,10 @@ COPY --from=backend /backend-build/bytebase /usr/local/bin/# Directory to store the data, which can be referenced as the mounting point.RUN mkdir -p /var/opt/bytebase+# Copy utility scripts, we have+# - Demo script to launch Bytebase in readonly demo mode+COPY ./scripts /usr/local/bin/+CMD ["--host", "http://localhost", "--port", "80", "--data", "/var/opt/bytebase"]ENTRYPOINT ["bytebase"]diff --git a/scripts/demo.sh b/scripts/demo.shnew file mode 100644index 0000000000..3097e0823a--- /dev/null+++ b/scripts/demo.sh@@ -0,0 +1,46 @@+#!/bin/sh++# For now, we use this script to start our demo on render+# by changing the ENTRYPOINT and CMD at the dockerfile to this.++# example usages:+# ./demo.sh+# ./demo.sh https://example.com+# ./demo.sh https://example.com:8080++# If no parameter is passed, use https://demo.bytebase.com as host and 80 as port by default+ONLINE_DEMO_HOST='https://demo.bytebase.com'+ONLINE_DEMO_PORT='80'+if [ $1 ]; then+ PROTOCAL=`echo $1 | awk -F ':' '{ print $1 }'`+ URI=`echo $1 | awk -F '[/:]' '{ print $4; }'`+ PORT=`echo $1 | awk -F '[/:]' '{ print $5; }'`++ ONLINE_DEMO_HOST=$PROTOCAL://$URI++ if [ $PORT ]; then+ ONLINE_DEMO_PORT=$PORT+ fi+fi++function seedDemoData(){+ echo 'Seeding data for online demo'++ bytebase --host ${ONLINE_DEMO_HOST} --port ${ONLINE_DEMO_PORT} --demo --data /var/opt/bytebase &++ echo 'Sleep 10 seconds for bytebase to finish migration...'++ sleep 10++ echo 'Killing seeding program'++ ps | grep 'bytebase' | grep -v grep | xargs kill -9+}++function startReadonly(){+ echo "Starting Bytebase in readonly and demo mode at ${ONLINE_DEMO_HOST}:${ONLINE_DEMO_PORT}..."++ bytebase --host ${ONLINE_DEMO_HOST} --port ${ONLINE_DEMO_PORT} --readonly --demo --data /var/opt/bytebase+}++seedDemoData; startReadonly