Skip to content

Commit

Permalink
Revert "Merge branch 'usingtechnology-feat/forms-1331-event-stream'"
Browse files Browse the repository at this point in the history
This reverts commit 2bee361, reversing
changes made to 0d49e8d.
  • Loading branch information
usingtechnology committed Sep 25, 2024
1 parent 6936fe6 commit beed1eb
Show file tree
Hide file tree
Showing 148 changed files with 8,047 additions and 18,050 deletions.
12 changes: 0 additions & 12 deletions .devcontainer/chefs_local/local.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@
"proxy": "352f7c24819086bf3df5a38c1a40586045f73e0007440c9d27d59ee8560e3fe7"
}
},
"features": {
"eventStreamService": true
},
"eventStreamService": {
"servers": "localhost:4222,localhost:4223,localhost:4224",
"websockets": "false",
"streamName": "CHEFS",
"source": "chefs-local",
"domain": "forms",
"username": "chefs",
"password": "password"
},
"serviceClient": {
"commonServices": {
"ches": {
Expand Down
11 changes: 0 additions & 11 deletions .devcontainer/chefs_local/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@
"proxy": "5fb2054478353fd8d514056d1745b3a9eef066deadda4b90967af7ca65ce6505"
}
},
"features": {
"eventStreamService": false
},
"eventStreamService": {
"servers": "localhost:4222,localhost:4223,localhost:4224",
"streamName": "CHEFS",
"source": "chefs",
"domain": "forms",
"username": "chefs",
"password": "password"
},
"serviceClient": {
"commonServices": {
"ches": {
Expand Down
9 changes: 0 additions & 9 deletions .github/actions/deploy-to-environment/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ runs:
run: |
oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/app.cm.yaml -p NAMESPACE=${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -p APP_NAME=${{ inputs.acronym }} -p JOB_NAME=${{ inputs.job_name }} -p SERVER_HOST=${{ inputs.server_host }} -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f -
- name: Deploy event stream ConfigMaps
shell: bash
run: |
if [[ "${{ inputs.job_name }}" == pr-* ]]; then
oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/ess.cm.yaml -p APP_NAME=${{ inputs.acronym }} -p JOB_NAME=${{ inputs.job_name }} -p SOURCE=${{ inputs.job_name }} -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f -
else
oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/ess.cm.yaml -p APP_NAME=${{ inputs.acronym }} -p JOB_NAME=${{ inputs.job_name }} --param-file=openshift/ess.${{ inputs.namespace_environment }}.param -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f -
fi
- name: Deploy App
shell: bash
run: |
Expand Down
36 changes: 9 additions & 27 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
<!--
The above Title for the Pull Request should use the format:
type: FORMS-ABCD your change description
For example:
feat: FORMS-1234 add Assigned To column to submission table
-->
<!-- Provide a general summary of your changes in the Title above -->

# Description

<!--
Describe your changes in detail.
- Why is this change required?
- What problem does it solve?
-->
<!-- Describe your changes in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->

## Type of Change
## Types of changes

<!--
Uncomment the main reason for the change. For example: all "feat" PRs should
include documentation ("docs") and tests ("test"), but only uncomment "feat".
-->
<!-- Uncomment the main reason for the change (for example, all feat PRs should include docs and test, but only uncomment feat): -->

<!-- feat (a new feature) -->
<!-- fix (a bug fix) -->
Expand All @@ -29,7 +18,6 @@ include documentation ("docs") and tests ("test"), but only uncomment "feat".
<!-- docs (change to documentation) -->
<!-- perf (change to improve performance) -->
<!-- refactor (change to improve code quality) -->
<!-- revert (reverts changes in a previous commit) -->
<!-- style (change to code style/formatting) -->
<!-- test (add missing tests or correct existing tests) -->

Expand All @@ -39,10 +27,8 @@ This is a breaking change because ...

## Checklist

<!--
Go over all the following points, and put an `x` in all the boxes that apply. If
you're unsure about any of these, don't hesitate to ask. We're here to help!
-->
<!-- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] I have read the [CONTRIBUTING](/bcgov/common-hosted-form-service/blob/main/CONTRIBUTING.md) doc
- [ ] I have checked that unit tests pass locally with my changes
Expand All @@ -53,8 +39,4 @@ you're unsure about any of these, don't hesitate to ask. We're here to help!

## Further comments

<!--
If this is a relatively large or complex change, kick off the discussion by
explaining why you chose the solution you did and what alternatives you
considered, etc...
-->
<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
53 changes: 2 additions & 51 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,15 @@ const middleware = require('./src/forms/common/middleware');
const v1Router = require('./src/routes/v1');

const DataConnection = require('./src/db/dataConnection');
const { featureFlags } = require('./src/components/featureFlags');
const dataConnection = new DataConnection();
const { eventStreamService } = require('./src/components/eventStreamService');

const apiRouter = express.Router();
const state = {
connections: {
data: false,
eventStreamService: false,
},
ready: false,
shutdown: false,
};

if (!featureFlags.eventStreamService) delete state.connections.eventStreamService;

let probeId;
const app = express();
app.use(compression());
Expand Down Expand Up @@ -65,16 +58,7 @@ apiRouter.use('/config', (_req, res, next) => {
const frontend = config.get('frontend');
// we will need to pass
const uploads = config.get('files.uploads');
const features = config.get('features');
const feConfig = { ...frontend, uploads: uploads, features: features };
if (featureFlags.eventStreamService) {
let ess = config.util.cloneDeep(config.get('eventStreamService'));
delete ess['username'];
delete ess['password'];
feConfig['eventStreamService'] = {
...ess,
};
}
const feConfig = { ...frontend, uploads: uploads };
res.status(200).json(feConfig);
} catch (err) {
next(err);
Expand Down Expand Up @@ -173,7 +157,6 @@ function cleanup() {
log.info('Cleaning up...', { function: 'cleanup' });
clearInterval(probeId);

if (featureFlags.eventStreamService) eventStreamService.closeConnection();
dataConnection.close(() => process.exit());

// Wait 10 seconds max before hard exiting
Expand All @@ -189,10 +172,6 @@ function initializeConnections() {
// Initialize connections and exit if unsuccessful
const tasks = [dataConnection.checkAll()];

if (featureFlags.eventStreamService) {
tasks.push(eventStreamService.checkConnection());
}

Promise.all(tasks)
.then((results) => {
state.connections.data = results[0];
Expand All @@ -201,23 +180,9 @@ function initializeConnections() {
log.info('DataConnection Reachable', {
function: 'initializeConnections',
});

if (featureFlags.eventStreamService) {
state.connections.eventStreamService = results[1];
if (state.connections.eventStreamService) {
log.info('EventStreamService Reachable', {
function: 'initializeConnections',
});
}
} else {
log.info('EventStreamService feature is not enabled.');
}
})
.catch((error) => {
log.error(`Initialization failed: Database OK = ${state.connections.data}`, { function: 'initializeConnections' });
if (featureFlags.eventStreamService)
log.error(`Initialization failed: EventStreamService OK = ${state.connections.eventStreamService}`, { function: 'initializeConnections' });

log.error('Connection initialization failure', error.message, {
function: 'initializeConnections',
});
Expand All @@ -233,16 +198,7 @@ function initializeConnections() {
function: 'initializeConnections',
});
// Start periodic 10 second connection probe check
probeId = setInterval(checkConnections, 30000);
} else {
log.error(`Service not ready to accept traffic`, {
function: 'initializeConnections',
});
log.error(`Database connected = ${state.connections.data}`, { function: 'initializeConnections' });
if (featureFlags.eventStreamService) log.error(`EventStreamService connected = ${state.connections.eventStreamService}`, { function: 'initializeConnections' });

process.exitCode = 1;
shutdown();
probeId = setInterval(checkConnections, 10000);
}
});
}
Expand All @@ -256,21 +212,16 @@ function checkConnections() {
const wasReady = state.ready;
if (!state.shutdown) {
const tasks = [dataConnection.checkConnection()];
if (featureFlags.eventStreamService) tasks.push(eventStreamService.checkConnection());

Promise.all(tasks).then((results) => {
state.connections.data = results[0];
if (featureFlags.eventStreamService) state.connections.eventStreamService = results[1];

state.ready = Object.values(state.connections).every((x) => x);
if (!wasReady && state.ready)
log.info('Service ready to accept traffic', {
function: 'checkConnections',
});
log.verbose(state);
if (!state.ready) {
log.error(`Database connected = ${state.connections.data}`, { function: 'checkConnections' });
if (featureFlags.eventStreamService) log.error(`EventStreamService connected = ${state.connections.eventStreamService}`, { function: 'checkConnections' });
process.exitCode = 1;
shutdown();
}
Expand Down
12 changes: 0 additions & 12 deletions app/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,6 @@
"proxy": "SERVER_ENCRYPTION_PROXY"
}
},
"features": {
"eventStreamService": "FEATURES_EVENTSTREAMSERVICE"
},
"eventStreamService": {
"servers": "EVENTSTREAMSERVICE_SERVERS",
"websockets": "EVENTSTREAMSERVICE_WEBSOCKETS",
"streamName": "EVENTSTREAMSERVICE_STREAMNAME",
"source": "EVENTSTREAMSERVICE_SOURCE",
"domain": "EVENTSTREAMSERVICE_DOMAIN",
"username": "EVENTSTREAMSERVICE_USERNAME",
"password": "EVENTSTREAMSERVICE_PASSWORD"
},
"serviceClient": {
"commonServices": {
"ches": {
Expand Down
12 changes: 0 additions & 12 deletions app/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@
"proxy": "352f7c24819086bf3df5a38c1a40586045f73e0007440c9d27d59ee8560e3fe7"
}
},
"features": {
"eventStreamService": true
},
"eventStreamService": {
"servers": "localhost:4222,localhost:4223,localhost:4224",
"websockets": "false",
"streamName": "CHEFS",
"source": "chefs-local",
"domain": "forms",
"username": "chefs",
"password": "password"
},
"serviceClient": {
"commonServices": {
"ches": {
Expand Down
Loading

0 comments on commit beed1eb

Please sign in to comment.