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

Improvements to simplify dev experience with go backend #2861

Merged
merged 16 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update docker-compose & Travis e2e script [e2e]
  • Loading branch information
Irfan Habib committed Aug 28, 2018
commit 6e04007f3fa1647a14905c9c6da4da5c0f09a8b4
6 changes: 0 additions & 6 deletions build/bk-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ STRATOS="`cd "${DIR}/..";pwd`"

pushd ${STRATOS} > /dev/null

# Make outputs folder
OUTPUTS=$STRATOS/outputs
mkdir -p ${OUTPUTS}

STRATOS_GOBASE=tmp/go/src/github.com/cloudfoundry-incubator/stratos
mkdir -p ${STRATOS_GOBASE}/src
Expand Down Expand Up @@ -68,9 +65,6 @@ pushd ${STRATOS_GOBASE}/src/jetstream > /dev/null
if [ "${ACTION}" == "build" ]; then
echo "Building backend ..."
go build
# Legacy name for now - will rename later
cp jetstream $OUTPUTS/portal-proxy

# Legacy - we will remove the need for this shortly
# if [ "$DEV" == "true" ]; then
# echo "Copying files to simplify running backend in dev ..."
Expand Down
2 changes: 1 addition & 1 deletion build/legacy/bk-conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
getCorePath: function (srcPath, executable) {
return path.join(srcPath, executable ? executable : '');
},
coreName: 'portal-proxy',
coreName: 'jetstream',
outputPath: path.join(__dirname, '..', 'outputs'),
srcPath: path.join(__dirname, 'src', 'backend'),
pluginFolder: path.join(__dirname, '..', 'src', 'backend'),
Expand Down
8 changes: 4 additions & 4 deletions deploy/Dockerfile.bk
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ RUN npm install
RUN npm run build-backend

FROM splatform/stratos-bk-base:opensuse as common-build
COPY --from=builder /home/stratos/go/src/github.com/cloudfoundry-incubator/stratos/outputs/* /srv/
RUN chmod +x /srv/portal-proxy
COPY --from=builder /home/stratos/go/src/github.com/cloudfoundry-incubator/stratos/src/jetstream/jetstream /srv/
RUN chmod +x /srv/jetstream

# use --target=db-migrator to build db-migrator image
FROM splatform/stratos-bk-base:opensuse as db-migrator
WORKDIR /src
COPY deploy/db/dbconf.yml db/dbconf.yml
COPY deploy/db/scripts/development.sh .
COPY deploy/db/scripts/wait-for-it.sh .
COPY --from=common-build /srv/portal-proxy .
COPY --from=common-build /srv/jetstream .
RUN chmod +x wait-for-it.sh
RUN chmod +x development.sh
CMD bash /src/wait-for-it.sh -t 90 mariadb:3306 && bash /src/development.sh

# use --target=postflight-job to build prod postflight-job
FROM splatform/stratos-bk-base:opensuse as postflight-job
RUN zypper -n in mariadb-client
COPY --from=common-build /srv/portal-proxy /usr/local/bin/portal-proxy
COPY --from=common-build /srv/jetstream /usr/local/bin/jetstream
COPY deploy/db/dbconf.yml db/dbconf.yml
COPY deploy/db/scripts/run-postflight-job.k8s.sh /run-postflight-job.sh
CMD ["/run-postflight-job.sh"]
Expand Down
4 changes: 2 additions & 2 deletions deploy/ci/travis/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ if [ "${RUN_TYPE}" == "quick" ]; then
npm run build
npm run build-backend
# Patch the config file so local version runs on port 443
pushd outputs
./portal-proxy > backend.log &
pushd src/jetstream
./jetstream > backend.log &
popd

E2E_TARGET="e2e -- --dev-server-target= --base-url=https://127.0.0.1:5443"
Expand Down
2 changes: 1 addition & 1 deletion deploy/cloud-foundry/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function handleGooseResult {
# Only migrate on instance index 0
if [ "$CF_INSTANCE_INDEX" -eq "0" ]; then
echo "Attempting to migrate database"
./portal-proxy -cf --path ${DB_CONF_DIR} up
./jetstream -cf --path ${DB_CONF_DIR} up
handleGooseResult
else
echo "Skipping DB migration => not index 0 ($CF_INSTANCE_INDEX)"
Expand Down
2 changes: 1 addition & 1 deletion deploy/containers/proxy/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [ "${NO_SHARED_MODE}" = "true" ]; then
/run-preflight-job.sh
fi

/srv/portal-proxy
/srv/jetstream
12 changes: 6 additions & 6 deletions deploy/db/scripts/development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ set -e

# Check the version
echo "Checking database version."
./portal-proxy --env=mariadb-development dbversion
./jetstream --env=mariadb-development dbversion

EXITVAL=$?
while [ $EXITVAL -ne 0 ]
do
echo "Failed to execute dbversion check, retrying after one second"
sleep 1
./portal-proxy --env=mariadb-development dbversion
./jetstream --env=mariadb-development dbversion
EXITVAL=$?
done

# Check the status
echo "Checking database status."
./portal-proxy --env=mariadb-development status
./jetstream --env=mariadb-development status

# Run migrations
echo "Attempting database migrations."
./portal-proxy --env=mariadb-development up
./jetstream --env=mariadb-development up

# CHeck the status
echo "Checking database status."
./portal-proxy --env=mariadb-development status
./jetstream --env=mariadb-development status

# Check the version
echo "Checking database version."
./portal-proxy --env=mariadb-development dbversion
./jetstream --env=mariadb-development dbversion

echo "Database operation(s) complete."

Expand Down
10 changes: 5 additions & 5 deletions deploy/db/scripts/run-postflight-job.k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ echo "DBCONFIG: $DBCONF_KEY"
echo "Connection string: $DB_USER:********@tcp($DB_HOST:$DB_PORT)/$DB_DATABASE_NAME?parseTime=true"
# Check the version
echo "Checking database version."
portal-proxy --env=$DBCONF_KEY dbversion
jetstream --env=$DBCONF_KEY dbversion

# Check the status
echo "Checking database status."
portal-proxy --env=$DBCONF_KEY status
jetstream --env=$DBCONF_KEY status

# Run migrations
echo "Attempting database migrations."
portal-proxy --env=$DBCONF_KEY up
jetstream --env=$DBCONF_KEY up

# CHeck the status
echo "Checking database status."
portal-proxy --env=$DBCONF_KEY status
jetstream --env=$DBCONF_KEY status

# Check the version
echo "Checking database version."
portal-proxy --env=$DBCONF_KEY dbversion
jetstream --env=$DBCONF_KEY dbversion

echo "Database operation(s) complete."

Expand Down