Skip to content
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
10 changes: 10 additions & 0 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ jobs:
# Give some time for the stack to come down fully
- run: sleep 15

# Update Permissions: api_sails crashes if a local DB attempt is used
# and we don't have permission to write there.
- name: update permissions
run: chmod 777 ./ab-test/developer/api_sails

- name: Launch Main Stack
run: ./UP.sh -t -q
working-directory: ./ab-test
Expand All @@ -67,6 +72,11 @@ jobs:
run: pm2 start ./logs.js -- --toFile logs/ABServices.log
working-directory: ./ab-test

# Give time for stack to come up fully
- run: sleep 120s

- run: docker service ls

- name: Run Cypress Tests (Main Stack)
run: npm run test:e2e:ab-runtime -- --browser chrome
working-directory: ./ab-test
Expand Down
35 changes: 34 additions & 1 deletion lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ Command.run = function (options) {
copyDBInit,
initializeDB,
runDbMigrations,
removeTempDBInitFiles,
configTenantAdmin,
installDeveloperFiles,
compileUI,
downStack,
initializeDBTest,
runDbMigrationsTest,
removeTempDBInitFiles,
devInstallEndMessage,
],
(err) => {
Expand Down Expand Up @@ -402,6 +404,25 @@ function initializeDB(done) {
// done();
}

function initializeDBTest(done) {
console.log("... initialize the Test DB tables");
const options = { ...Options };
// Keep this stack running for DB migrations
options.keepRunning = true;
options.stack = `test_${Options.stack}`;
utils
.dbInit(options, "dbinit-compose.yml")
.then((skipped) => {
Options.__dbSkipped = skipped;
done();
})
.catch((err) => {
done(err);
});
// shell.exec(path.join(process.cwd(), "DBInit.js"));
// done();
}

/**
* run our db migrations from migration manager
*/
Expand All @@ -417,6 +438,18 @@ async function runDbMigrations() {
await utils.runDbMigrations(params);
}

async function runDbMigrationsTest() {
if (Options.__dbSkipped) return;

console.log("... run db migration scripts for test stack");
const params = {
stack: `test_${Options.stack}`,
keepRunning: false,
platform: Options.platform,
};
await utils.runDbMigrations(params);
}

/**
* @function downStack()
* bring the stack back down to finish out our install
Expand Down
2 changes: 1 addition & 1 deletion lib/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ function questions(done) {
Options.sailsSessionSecret = nanoid(32);

Options.cypressBaseURL = `http://localhost:${Options.port ?? 80}`;
Options.cypressStack = Options.stack ?? "ab";
Options.cypressStack = `test_${Options.stack ?? "ab"}`;

// console.log("Options:", Options);
settingTags.then(done);
Expand Down
19 changes: 15 additions & 4 deletions templates/setup/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ services:
# when there is a problem with : Error: ER_CRASHED_ON_USAGE: Table 'AAAAAA' is marked as crashed and should be repaired
# this can happen with the alter table algorithm: try the safest(and slowest) COPY
# eslint-disable-next-line
command: ["mysqld", "--alter-algorithm=copy", "--wait-timeout=60", "--interactive-timeout=60"]
command:
[
"mysqld",
"--alter-algorithm=copy",
"--wait-timeout=60",
"--interactive-timeout=60",
]
#/db

#redis: use redis to allow cote services to find each other across a swarm
Expand All @@ -56,7 +62,9 @@ services:

#api_sails: our API end point
api_sails:
image: node
# NOTE: since our file_processor is using our docker image, we should use
# our api-sails image so USER permissions are correct between the two services.
image: docker.io/digiserve/ab-api-sails:$AB_API_SAILS_VERSION
environment:
- COTE_DISCOVERY_REDIS_HOST=redis
- NODE_ENV=development
Expand Down Expand Up @@ -92,8 +100,9 @@ services:
- files:/data
depends_on:
- redis
working_dir: /app
command: ["node", "--inspect=0.0.0.0:9229", "app_waitMysql.js"]
# NOTE: our working image already sets this up:
# working_dir: /app
# command: ["node", "--inspect=0.0.0.0:9229", "app_waitMysql.js"]
#/api_sails

#appbuilder: (AppBuilder) A multi-tenant aware service to process our AppBuilder requests.
Expand Down Expand Up @@ -214,6 +223,8 @@ services:

#file_processor: A service to manage uploaded files.
file_processor:
# NOTE: our docker image contains additional utils not found in the node
# image, so we use that instead.
image: docker.io/digiserve/ab-file-processor:$AB_FILE_PROCESSOR_VERSION
environment:
- COTE_DISCOVERY_REDIS_HOST=redis
Expand Down
Loading