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

Demo: Upgrade automation project #30480

Closed
wants to merge 4 commits into from
Closed
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
72 changes: 72 additions & 0 deletions upgrade_project/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
networks:
http_net:
db_net:
es_net:

volumes:
cms-shared:
dbdata:
esdata:

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch from elasticsearch to
image: opensearchproject/opensearch:1

environment:
- cluster.name=elastic-cluster
- discovery.type=single-node
- data
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xmx1G "
#ports:
#- 9200:9200
#- 9600:9600
volumes:
- esdata:/usr/share/elasticsearch/data
networks:
- es_net

dotcms:
image: ${docker_tag}
environment:
"CATALINA_OPTS": ' -Xms1g -Xmx1g '
"DB_BASE_URL": "jdbc:postgresql://db/dotcms"
"DB_USERNAME": 'dotcmsdbuser'
"DB_PASSWORD": 'password'
"DOT_ES_AUTH_BASIC_PASSWORD": 'admin'
"DOT_INITIAL_ADMIN_PASSWORD": "admin"
"DOT_ES_ENDPOINTS": 'http://elasticsearch:9200'
"CUSTOM_STARTER_URL": ${custom_starter}

"DOT_CIRCUIT_BREAKER_MAX_CONN_TOTAL": "3"

#EDIT CONTENT
"DOT_CONTENT_EDITOR2_ENABLED": "true"
"DOT_CONTENT_EDITOR2_CONTENT_TYPE" : "true"
"DOT_FEATURE_FLAG_NEW_EDIT_PAGE": "true"

depends_on:
- elasticsearch
- db
volumes:
- cms-shared:/data/shared
#- [serverpath]/license.zip:/data/shared/assets/license.zip
networks:
- db_net
- es_net
ports:
- "8080:8080"
- "8443:8443"

db:
image: postgres:15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use image: pgvector/pgvector:pg16

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to use this since the version that we are trying to upgrade is not compatible with this pg version (dotcms/dotcms:23.10.24_lts_v17_8b0be94)

command: postgres -c 'max_connections=400' -c 'shared_buffers=128MB'
environment:
"POSTGRES_USER": 'dotcmsdbuser'
"POSTGRES_PASSWORD": 'password'
"POSTGRES_DB": 'dotcms'
volumes:
- dbdata:/var/lib/postgresql/data
networks:
- db_net
ports:
- "15432:5432"
104 changes: 104 additions & 0 deletions upgrade_project/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions upgrade_project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"devDependencies": {
"@types/node": "^22.7.5"
},
"dependencies": {
"@playwright/test": "^1.48.1",
"dotenv": "^16.4.5"
},
"type": "module"
}
9 changes: 9 additions & 0 deletions upgrade_project/playwrightTests/ playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
testDir: './',
timeout: 60000,
use: {
headless: false,
browserName: 'chromium' // Browser to use (chromium, firefox, webkit)
},
testMatch: '**/*.spec.js' // Pattern to match test files
};
65 changes: 65 additions & 0 deletions upgrade_project/playwrightTests/upgradeStatus.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { test, expect } from '@playwright/test';
import * as dotenv from 'dotenv';


dotenv.config({ path: 'properties/config.properties' });

const serverURL = process.env.BASE_URL;
async function login(page) {
test.setTimeout(40000);

await page.goto(`${serverURL}/c`);

let title = await page.title();
expect(title).toBe('dotCMS Content Management Platform');
await page.getByTestId('header').isVisible();
await page.fill('input[id="inputtext"]', '[email protected]');
await page.fill('input[id="password"]', 'admin');
await page.getByTestId('submitButton').click();
await page.waitForURL(`${serverURL}/dotAdmin/#/starter`);

title = await page.title();
console.log('Page title after login:', title);
expect(title).toBe('Welcome - dotCMS Content Management Platform');
}

test('Verify dotCMS UI is running and ready', async ({ page }) => {
await login(page);
});

// Second test that makes a reindex after logging in
test('Make a reindex', async ({ page }) => {
test.setTimeout(60000);
await login(page);

// Open the settings menu
await page.getByText('settingsSettingsarrow_drop_up').click();
await page.getByRole('link', { name: 'Maintenance' }).click();

// Switch to the relevant frame and click the 'Index' tab
await page.frameLocator('iframe[name="detailFrame"]').getByRole('tab', { name: 'Index' }).click();
await page.locator('iframe[name="detailFrame"]').contentFrame().locator('#live_20241017194349Row').getByRole('cell', { name: 'Active' }).isVisible();

// Wait for the dialog to appear and accept it
page.once('dialog', async dialog => {
//console.log(`Dialog message: ${dialog.message()}`);
await dialog.accept('2'); // Accept the dialog
});

// Click the Reindex button in the iframe
await page.frameLocator('iframe[name="detailFrame"]').getByLabel('Reindex', { exact: true }).click();

await page.waitForTimeout(3000); // Wait for 3 seconds

// Verify that the reindexing message is visible
await expect(page.locator('iframe[name="detailFrame"]').contentFrame().getByText('A full reindex is in progress.')).toBeVisible();
await expect(page.locator('iframe[name="detailFrame"]').contentFrame().getByText('A full reindex is in progress.')).toBeHidden({ timeout: 60000 });
});








29 changes: 29 additions & 0 deletions upgrade_project/playwrightTests/validateStatus.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test, expect } from '@playwright/test';
import * as dotenv from 'dotenv';


dotenv.config({ path: 'properties/config.properties' });


const serverURL = process.env.BASE_URL;
test('Verify dotCMS UI is running and ready', async ({ page }) => {
test.setTimeout(60000);
await page.goto(`${serverURL}/c`);

let title = await page.title();
console.log('Page title before login:', title);
expect(title).toBe('dotCMS Content Management Platform');
await page.getByTestId('header').isVisible();

await page.fill('input[id="inputtext"]', '[email protected]');
await page.fill('input[id="password"]', 'admin');
await page.getByTestId('submitButton').click();
await page.waitForURL("http://localhost:8080/dotAdmin/#/starter");

title = await page.title();
console.log('Page title after login:', title);
expect(title).toBe('Welcome - dotCMS Content Management Platform');
});



17 changes: 17 additions & 0 deletions upgrade_project/properties/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[TEST1]
# Version to upgrade from
docker_tag_from=dotcms/dotcms:23.10.24_lts_v17_8b0be94

# Version to upgrade to
docker_tag_to=dotcms/dotcms:trunk_3f68810
expected_db_version=241016

# Provice custom starter URL if is needed
custom_starter=https://repo.dotcms.com/artifactory/libs-release-local/com/dotcms/starter/20240807/starter-20240807.zip


[PLAYWRIGHT]
# PLAYRIGHT Properties
BASE_URL=http://localhost:8080
[email protected]
password=admin
4 changes: 4 additions & 0 deletions upgrade_project/test-results/.last-run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"status": "passed",
"failedTests": []
}
Loading
Loading