-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Add sample docs for running GOE via Google Cloud Run #186
base: main
Are you sure you want to change the base?
Changes from all commits
d66d476
4bbb279
1d455d7
47bae0e
144c32a
9f5291a
6f1b8d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2024 The GOE Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM google/cloud-sdk:slim | ||
RUN apt-get update | ||
# Oracle client | ||
RUN apt-get -y install libaio1 libaio-dev unzip wget | ||
RUN wget -q https://download.oracle.com/otn_software/linux/instantclient/218000/instantclient-sdk-linux.x64-21.8.0.0.0dbru.zip && \ | ||
wget -q https://download.oracle.com/otn_software/linux/instantclient/218000/instantclient-basic-linux.x64-21.8.0.0.0dbru.zip && \ | ||
wget -q https://download.oracle.com/otn_software/linux/instantclient/218000/instantclient-tools-linux.x64-21.8.0.0.0dbru.zip && \ | ||
mkdir /opt/oracle && \ | ||
unzip instantclient-sdk-linux.x64-21.8.0.0.0dbru.zip -d /opt/oracle/ && \ | ||
unzip instantclient-basic-linux.x64-21.8.0.0.0dbru.zip -d /opt/oracle/ && \ | ||
unzip instantclient-tools-linux.x64-21.8.0.0.0dbru.zip -d /opt/oracle/ | ||
ENV ORACLE_HOME=/opt/oracle/instantclient_21_8 | ||
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient_21_8 | ||
# Python pre-reqs (gcc for cx_Oracle) | ||
RUN apt-get install python3.11 python3.11-venv gcc -y | ||
# Install GOE | ||
ENV OFFLOAD_HOME=/opt/goe/offload | ||
RUN mkdir /opt/goe | ||
COPY goe.tar.gz /opt/goe/ | ||
RUN cd /opt/goe && tar xf goe.tar.gz | ||
RUN cd ${OFFLOAD_HOME} && python3.11 -m venv ./.venv | ||
COPY offload.env ${OFFLOAD_HOME}/conf/ | ||
RUN . ${OFFLOAD_HOME}/.venv/bin/activate && pip install --root-user-action=ignore --upgrade pip | ||
RUN . ${OFFLOAD_HOME}/.venv/bin/activate && pip install --root-user-action=ignore ${OFFLOAD_HOME}/lib/goe-$(cat ${OFFLOAD_HOME}/version)-py3-none-any.whl | ||
# Entrypoint | ||
COPY goe.sh /opt/goe/ | ||
RUN chmod 500 /opt/goe/goe.sh | ||
ENTRYPOINT ["/opt/goe/goe.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Executing GOE Commands via Cloud Run Jobs | ||
|
||
Below is an example of how to submit GOE using Cloud Build and then execute GOE commands via Cloud Run. | ||
|
||
## Pre-requisites | ||
|
||
You must first have: | ||
|
||
- Installed the GOE repository into the source RDBMS system using the same version of the software that will be built in this process. | ||
- Prepared and tested your `offload.env` file. | ||
|
||
## Helper variables | ||
|
||
``` | ||
GOE_VERSION=1.0.3 | ||
PROJECT=your-project | ||
REGION=europe-west1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this say |
||
NETWORK=goe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this say |
||
BUCKET=your-bucket | ||
SVC_ACCOUNT="your-goe-service-account@${PROJECT}.iam.gserviceaccount.com" | ||
``` | ||
|
||
## Create a GOE Build | ||
|
||
Follow these steps from within the directory containing the `Dockerfile` and `goe.sh` files. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Presumably until you get to the next step (download the GOE release), users won't have |
||
|
||
### Download a GOE release | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this reiterate that the GOE release should match the one you've already installed and prepared the |
||
|
||
For example: | ||
``` | ||
wget -q -O goe.tar.gz \ | ||
https://github.com/gluent/goe/releases/download/v${GOE_VERSION}/goe.tar.gz | ||
``` | ||
|
||
### Include an Offload configuration file | ||
|
||
For example: | ||
``` | ||
scp goe-node:/opt/goe/offload/conf/offload.env ./ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should |
||
``` | ||
|
||
It is recommended to set OFFLOAD_LOGDIR to a Google Cloud Storage location in your `offload.env` file. | ||
|
||
### Submit the Build | ||
|
||
``` | ||
gcloud builds submit . --tag gcr.io/${PROJECT}/goe-${GOE_VERSION} \ | ||
--project=${PROJECT} --region=${REGION} \ | ||
--gcs-log-dir=gs://${BUCKET}/gcbr-logs | ||
``` | ||
|
||
## Example Connect Command | ||
|
||
``` | ||
JOB_NAME=connect-$(date +'%Y%m%d-%H%M%S') | ||
|
||
gcloud run jobs create ${JOB_NAME} \ | ||
--project=${PROJECT} --region ${REGION} \ | ||
--network=${NETWORK} \ | ||
--service-account=${SVC_ACCOUNT} \ | ||
--image gcr.io/${PROJECT}/goe-${GOE_VERSION} \ | ||
--max-retries 0 \ | ||
--args "connect,--no-ansi" | ||
|
||
gcloud run jobs execute ${JOB_NAME} --wait \ | ||
--project=${PROJECT} --region=${REGION} | ||
``` | ||
|
||
## Example Offload Command | ||
|
||
``` | ||
JOB_NAME=offload-ACME-FACT-$(date +'%Y%m%d-%H%M%S') | ||
|
||
gcloud run jobs create ${JOB_NAME} \ | ||
--project=${PROJECT} --region ${REGION} \ | ||
--network=${NETWORK} \ | ||
--service-account=${SVC_ACCOUNT} \ | ||
--image gcr.io/${PROJECT}/goe-${GOE_VERSION} \ | ||
--max-retries 0 \ | ||
--args "offload,-t,acme.fact,-x,--no-ansi" | ||
|
||
gcloud run jobs execute ${JOB_NAME} --wait \ | ||
--project=${PROJECT} --region=${REGION} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
# Copyright 2024 The GOE Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if [[ -z "$1" ]];then | ||
echo "Usage: $0 offload ..." | ||
echo " or: $0 connect" | ||
exit 1 | ||
fi | ||
|
||
if [[ "$1" != "connect" && "$1" != "offload" ]];then | ||
echo "Usage: $0 offload ..." | ||
echo " or: $0 connect" | ||
exit 1 | ||
fi | ||
|
||
export USER=$(whoami) | ||
. ${OFFLOAD_HOME}/.venv/bin/activate | ||
$* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be something like
x.y.z
rather than hard-coded to1.0.3
?