Skip to content
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

fix - fn-go-psql / fn-python-psql #67

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions basis/bin/shared_bash_function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ build_function() {
fn update context oracle.compartment-id ${TF_VAR_compartment_ocid}
fn update context api-url https://functions.${TF_VAR_region}.oraclecloud.com
fn update context registry ${TF_VAR_ocir}/${TF_VAR_namespace}
# Set pipefail to get the error despite pip to tee
set -o pipefail
fn build -v | tee $TARGET_DIR/fn_build.log
exit_on_error

if grep --quiet "built successfully" $TARGET_DIR/fn_build.log; then
fn bump
# Store the image name and DB_URL in files
Expand All @@ -61,6 +65,9 @@ build_function() {
# Push the image to docker
docker login ${TF_VAR_ocir} -u ${TF_VAR_namespace}/${TF_VAR_username} -p "${TF_VAR_auth_token}"
docker push $TF_VAR_fn_image
else
echo "build_function - built successfully not found"
exit 1
fi

# First create the Function using terraform
Expand Down
2 changes: 1 addition & 1 deletion option/src/app/fn/fn_common/build_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Deploy with terraform
# Then Work-around: terraforms is not able to create a APIGW with dynamic multiple backends
build_function $DB_URL

exit_on_error
2 changes: 1 addition & 1 deletion option/src/app/fn/fn_go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN groupadd --gid 1000 fn && adduser --uid 1000 --gid fn fn
RUN yum -y install oracle-release-el7 oracle-golang-release-el7 && \
yum -y install oracle-instantclient-release-el7 && \
yum-config-manager --disable ol7_developer_EPEL && \
yum -y install oracle-instantclient-basic oracle-instantclient-sqlplus gcc golang && \
yum -y install oracle-instantclient-basic oracle-instantclient-sqlplus gcc golang git && \
rm -rf /var/cache/yum

# Install the program
Expand Down
5 changes: 1 addition & 4 deletions option/src/app/fn/fn_go_psql/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io"
fdk "github.com/fnproject/fdk-go"
"database/sql"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
"os"
)

Expand All @@ -25,8 +25,6 @@ func myHandler(ctx context.Context, in io.Reader, out io.Writer) {
psqlInfo := fmt.Sprintf("host=%s port=5432 user=%s password=%s dbname=postgres sslmode=require",
os.Getenv("DB_URL"), os.Getenv("DB_USER"), os.Getenv("DB_PASSWORD"))
db, err := sql.Open("postgres", psqlInfo)

db, err := sql.Open("mysql", os.Getenv("DB_USER")+":"+os.Getenv("DB_PASSWORD")+"@tcp("+os.Getenv("DB_URL")+")/db1")
if err != nil {
fmt.Println(err)
return
Expand All @@ -51,4 +49,3 @@ func myHandler(ctx context.Context, in io.Reader, out io.Writer) {
}
json.NewEncoder(out).Encode(&d)
}

1 change: 1 addition & 0 deletions option/src/app/fn/fn_java/build_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
. $BIN_DIR/build_common.sh

build_function $JDBC_URL
exit_on_error
2 changes: 1 addition & 1 deletion option/src/app/fn/fn_python/requirements.j2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ oracledb
# 8.0.29 removed the support for Python 3.6 used
mysql-connector-python==8.0.28
{%- elif db_family == "psql" %}
psycopg2
psycopg2-binary
{%- endif %}
1 change: 0 additions & 1 deletion option/src/app/php/src/install.j2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ sudo ./wa_php_oci.sh
sudo yum install -y php-pgsql
{%- endif %}


if grep -q '##DB_URL##' php.ini.append; then
sed -i "s!##DB_URL##!$DB_URL!" php.ini.append
sudo sh -c "cat php.ini.append >> /etc/php.ini"
Expand Down
2 changes: 2 additions & 0 deletions option/test_suite_group_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ loop_lang () {
if [ "$OPTION_DEPLOY" != "function" ]; then
OPTION_LANG=php
loop_db
fi
if [ "$OPTION_DEPLOY" == "compute" ]; then
OPTION_LANG=apex
OPTION_DB=atp
loop_shape
Expand Down