clawsql 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -21
- package/dist/api/routes/instances.d.ts.map +1 -1
- package/dist/api/routes/instances.js +9 -6
- package/dist/api/routes/instances.js.map +1 -1
- package/dist/api/schemas/index.d.ts +142 -142
- package/dist/app.js +2 -2
- package/dist/cli/commands/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/cleanup.js +40 -44
- package/dist/cli/commands/cleanup.js.map +1 -1
- package/dist/cli/commands/instances.d.ts.map +1 -1
- package/dist/cli/commands/instances.js +41 -22
- package/dist/cli/commands/instances.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +16 -36
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stop.d.ts.map +1 -1
- package/dist/cli/commands/stop.js +18 -35
- package/dist/cli/commands/stop.js.map +1 -1
- package/dist/cli/utils/command-executor.d.ts +62 -0
- package/dist/cli/utils/command-executor.d.ts.map +1 -0
- package/dist/cli/utils/command-executor.js +224 -0
- package/dist/cli/utils/command-executor.js.map +1 -0
- package/dist/config/settings.js +1 -1
- package/dist/core/discovery/topology.d.ts +2 -0
- package/dist/core/discovery/topology.d.ts.map +1 -1
- package/dist/core/discovery/topology.js +48 -7
- package/dist/core/discovery/topology.js.map +1 -1
- package/docker/Dockerfile.allinone +37 -28
- package/docker/orchestrator/orchestrator.conf.json +2 -2
- package/docker-compose.demo.yml +26 -17
- package/docker-compose.yml +3 -0
- package/init/metadata.sql +11 -0
- package/init/primary.sql +2 -12
- package/init/replica-host.sql +7 -0
- package/init/replica.sql +12 -2
- package/package.json +1 -1
- package/dist/__tests__/config/settings.test.d.ts +0 -5
- package/dist/__tests__/config/settings.test.d.ts.map +0 -1
- package/dist/__tests__/config/settings.test.js +0 -154
- package/dist/__tests__/config/settings.test.js.map +0 -1
- package/dist/__tests__/core/discovery/topology.test.d.ts +0 -5
- package/dist/__tests__/core/discovery/topology.test.d.ts.map +0 -1
- package/dist/__tests__/core/discovery/topology.test.js +0 -191
- package/dist/__tests__/core/discovery/topology.test.js.map +0 -1
- package/dist/__tests__/core/failover/executor.test.d.ts +0 -5
- package/dist/__tests__/core/failover/executor.test.d.ts.map +0 -1
- package/dist/__tests__/core/failover/executor.test.js +0 -256
- package/dist/__tests__/core/failover/executor.test.js.map +0 -1
- package/dist/__tests__/core/monitoring/collector.test.d.ts +0 -5
- package/dist/__tests__/core/monitoring/collector.test.d.ts.map +0 -1
- package/dist/__tests__/core/monitoring/collector.test.js +0 -131
- package/dist/__tests__/core/monitoring/collector.test.js.map +0 -1
- package/dist/__tests__/core/monitoring/exporters.test.d.ts +0 -5
- package/dist/__tests__/core/monitoring/exporters.test.d.ts.map +0 -1
- package/dist/__tests__/core/monitoring/exporters.test.js +0 -90
- package/dist/__tests__/core/monitoring/exporters.test.js.map +0 -1
- package/dist/__tests__/core/routing/proxysql-manager.test.d.ts +0 -5
- package/dist/__tests__/core/routing/proxysql-manager.test.d.ts.map +0 -1
- package/dist/__tests__/core/routing/proxysql-manager.test.js +0 -155
- package/dist/__tests__/core/routing/proxysql-manager.test.js.map +0 -1
- package/dist/__tests__/types/index.test.d.ts +0 -5
- package/dist/__tests__/types/index.test.d.ts.map +0 -1
- package/dist/__tests__/types/index.test.js +0 -290
- package/dist/__tests__/types/index.test.js.map +0 -1
- package/dist/__tests__/utils/exceptions.test.d.ts +0 -5
- package/dist/__tests__/utils/exceptions.test.d.ts.map +0 -1
- package/dist/__tests__/utils/exceptions.test.js +0 -142
- package/dist/__tests__/utils/exceptions.test.js.map +0 -1
- package/dist/cli/commands/health.d.ts +0 -12
- package/dist/cli/commands/health.d.ts.map +0 -1
- package/dist/cli/commands/health.js +0 -125
- package/dist/cli/commands/health.js.map +0 -1
- package/docker/init/primary.sql +0 -26
- package/docker/init/replica.sql +0 -16
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Tests for ClawSQL custom exceptions
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const exceptions_1 = require("../../utils/exceptions");
|
|
7
|
-
describe('ClawSQLError', () => {
|
|
8
|
-
it('should create error with code and message', () => {
|
|
9
|
-
const error = new exceptions_1.ClawSQLError('TEST_ERROR', 'Test error message');
|
|
10
|
-
expect(error.name).toBe('ClawSQLError');
|
|
11
|
-
expect(error.code).toBe('TEST_ERROR');
|
|
12
|
-
expect(error.message).toBe('Test error message');
|
|
13
|
-
expect(error.details).toEqual({});
|
|
14
|
-
});
|
|
15
|
-
it('should create error with details', () => {
|
|
16
|
-
const details = { key: 'value', count: 42 };
|
|
17
|
-
const error = new exceptions_1.ClawSQLError('TEST_ERROR', 'Test message', details);
|
|
18
|
-
expect(error.details).toEqual(details);
|
|
19
|
-
});
|
|
20
|
-
it('should serialize to JSON correctly', () => {
|
|
21
|
-
const error = new exceptions_1.ClawSQLError('TEST_ERROR', 'Test message', { foo: 'bar' });
|
|
22
|
-
const json = error.toJSON();
|
|
23
|
-
expect(json).toEqual({
|
|
24
|
-
error: 'TEST_ERROR',
|
|
25
|
-
message: 'Test message',
|
|
26
|
-
details: { foo: 'bar' },
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
it('should have stack trace', () => {
|
|
30
|
-
const error = new exceptions_1.ClawSQLError('TEST_ERROR', 'Test message');
|
|
31
|
-
expect(error.stack).toBeDefined();
|
|
32
|
-
expect(error.stack).toContain('ClawSQLError');
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe('ValidationError', () => {
|
|
36
|
-
it('should create validation error', () => {
|
|
37
|
-
const error = new exceptions_1.ValidationError('Invalid input', { field: 'name' });
|
|
38
|
-
expect(error.name).toBe('ValidationError');
|
|
39
|
-
expect(error.code).toBe('VALIDATION_ERROR');
|
|
40
|
-
expect(error.message).toBe('Invalid input');
|
|
41
|
-
expect(error.details).toEqual({ field: 'name' });
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
describe('NotFoundError', () => {
|
|
45
|
-
it('should create not found error for resource', () => {
|
|
46
|
-
const error = new exceptions_1.NotFoundError('Cluster', 'cluster-123');
|
|
47
|
-
expect(error.name).toBe('NotFoundError');
|
|
48
|
-
expect(error.code).toBe('NOT_FOUND');
|
|
49
|
-
expect(error.message).toBe('Cluster not found: cluster-123');
|
|
50
|
-
expect(error.details).toEqual({ resource: 'Cluster', identifier: 'cluster-123' });
|
|
51
|
-
});
|
|
52
|
-
it('should create not found error for instance', () => {
|
|
53
|
-
const error = new exceptions_1.NotFoundError('Instance', 'localhost:3306');
|
|
54
|
-
expect(error.message).toBe('Instance not found: localhost:3306');
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe('AlreadyExistsError', () => {
|
|
58
|
-
it('should create already exists error', () => {
|
|
59
|
-
const error = new exceptions_1.AlreadyExistsError('Instance', 'localhost:3306');
|
|
60
|
-
expect(error.name).toBe('AlreadyExistsError');
|
|
61
|
-
expect(error.code).toBe('ALREADY_EXISTS');
|
|
62
|
-
expect(error.message).toBe('Instance already exists: localhost:3306');
|
|
63
|
-
expect(error.details).toEqual({ resource: 'Instance', identifier: 'localhost:3306' });
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
describe('ConnectionError', () => {
|
|
67
|
-
it('should create connection error', () => {
|
|
68
|
-
const error = new exceptions_1.ConnectionError('Failed to connect to database', { host: 'localhost' });
|
|
69
|
-
expect(error.name).toBe('ConnectionError');
|
|
70
|
-
expect(error.code).toBe('CONNECTION_ERROR');
|
|
71
|
-
expect(error.message).toBe('Failed to connect to database');
|
|
72
|
-
expect(error.details).toEqual({ host: 'localhost' });
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
describe('OrchestratorError', () => {
|
|
76
|
-
it('should create orchestrator error', () => {
|
|
77
|
-
const error = new exceptions_1.OrchestratorError('Orchestrator unreachable', { url: 'http://orchestrator:3000' });
|
|
78
|
-
expect(error.name).toBe('OrchestratorError');
|
|
79
|
-
expect(error.code).toBe('ORCHESTRATOR_ERROR');
|
|
80
|
-
expect(error.message).toBe('Orchestrator unreachable');
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
describe('ProxySQLError', () => {
|
|
84
|
-
it('should create proxysql error', () => {
|
|
85
|
-
const error = new exceptions_1.ProxySQLError('Failed to add server', { hostgroup: 10 });
|
|
86
|
-
expect(error.name).toBe('ProxySQLError');
|
|
87
|
-
expect(error.code).toBe('PROXYSQL_ERROR');
|
|
88
|
-
expect(error.message).toBe('Failed to add server');
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
describe('FailoverError', () => {
|
|
92
|
-
it('should create failover error', () => {
|
|
93
|
-
const error = new exceptions_1.FailoverError('Failover failed', { clusterId: 'cluster-1' });
|
|
94
|
-
expect(error.name).toBe('FailoverError');
|
|
95
|
-
expect(error.code).toBe('FAILOVER_ERROR');
|
|
96
|
-
expect(error.message).toBe('Failover failed');
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
describe('AuthenticationError', () => {
|
|
100
|
-
it('should create authentication error with default message', () => {
|
|
101
|
-
const error = new exceptions_1.AuthenticationError();
|
|
102
|
-
expect(error.name).toBe('AuthenticationError');
|
|
103
|
-
expect(error.code).toBe('AUTHENTICATION_ERROR');
|
|
104
|
-
expect(error.message).toBe('Authentication failed');
|
|
105
|
-
});
|
|
106
|
-
it('should create authentication error with custom message', () => {
|
|
107
|
-
const error = new exceptions_1.AuthenticationError('Invalid token');
|
|
108
|
-
expect(error.message).toBe('Invalid token');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
describe('AuthorizationError', () => {
|
|
112
|
-
it('should create authorization error with default message', () => {
|
|
113
|
-
const error = new exceptions_1.AuthorizationError();
|
|
114
|
-
expect(error.name).toBe('AuthorizationError');
|
|
115
|
-
expect(error.code).toBe('AUTHORIZATION_ERROR');
|
|
116
|
-
expect(error.message).toBe('Access denied');
|
|
117
|
-
});
|
|
118
|
-
it('should create authorization error with custom message', () => {
|
|
119
|
-
const error = new exceptions_1.AuthorizationError('Insufficient permissions');
|
|
120
|
-
expect(error.message).toBe('Insufficient permissions');
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
describe('Error inheritance', () => {
|
|
124
|
-
it('all errors should be instance of ClawSQLError', () => {
|
|
125
|
-
const errors = [
|
|
126
|
-
new exceptions_1.ValidationError('test'),
|
|
127
|
-
new exceptions_1.NotFoundError('Resource', 'id'),
|
|
128
|
-
new exceptions_1.AlreadyExistsError('Resource', 'id'),
|
|
129
|
-
new exceptions_1.ConnectionError('test'),
|
|
130
|
-
new exceptions_1.OrchestratorError('test'),
|
|
131
|
-
new exceptions_1.ProxySQLError('test'),
|
|
132
|
-
new exceptions_1.FailoverError('test'),
|
|
133
|
-
new exceptions_1.AuthenticationError(),
|
|
134
|
-
new exceptions_1.AuthorizationError(),
|
|
135
|
-
];
|
|
136
|
-
for (const error of errors) {
|
|
137
|
-
expect(error).toBeInstanceOf(exceptions_1.ClawSQLError);
|
|
138
|
-
expect(error).toBeInstanceOf(Error);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
//# sourceMappingURL=exceptions.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.test.js","sourceRoot":"","sources":["../../../src/__tests__/utils/exceptions.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,uDAWgC;AAEhC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,KAAK,GAAG,IAAI,yBAAY,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;QAEnE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,IAAI,C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
6
|
-
import { Command } from '../registry.js';
|
|
7
|
-
/**
|
|
8
|
-
* Health command
|
|
9
|
-
*/
|
|
10
|
-
export declare const healthCommand: Command;
|
|
11
|
-
export default healthCommand;
|
|
12
|
-
//# sourceMappingURL=health.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/health.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAc,MAAM,gBAAgB,CAAC;AAGrD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,OAyG3B,CAAC;AAWF,eAAe,aAAa,CAAC"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ClawSQL CLI - Health Command
|
|
4
|
-
*
|
|
5
|
-
* Shows health status of system components.
|
|
6
|
-
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.healthCommand = void 0;
|
|
12
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
-
/**
|
|
14
|
-
* Health command
|
|
15
|
-
*/
|
|
16
|
-
exports.healthCommand = {
|
|
17
|
-
name: 'health',
|
|
18
|
-
description: 'Show system health status',
|
|
19
|
-
usage: '/health [component]',
|
|
20
|
-
handler: async (_args, ctx) => {
|
|
21
|
-
const formatter = ctx.formatter;
|
|
22
|
-
const orchestrator = ctx.orchestrator;
|
|
23
|
-
const proxysql = ctx.proxysql;
|
|
24
|
-
// Collect health data
|
|
25
|
-
const healthData = { components: {}, clusters: [] };
|
|
26
|
-
// Check Orchestrator
|
|
27
|
-
let orchestratorHealth;
|
|
28
|
-
try {
|
|
29
|
-
const isHealthy = await orchestrator.healthCheck();
|
|
30
|
-
orchestratorHealth = isHealthy ? 'healthy' : 'unhealthy';
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
orchestratorHealth = 'unreachable';
|
|
34
|
-
}
|
|
35
|
-
healthData.components.Orchestrator = orchestratorHealth;
|
|
36
|
-
// Check ProxySQL
|
|
37
|
-
let proxysqlHealth;
|
|
38
|
-
try {
|
|
39
|
-
await proxysql.connect();
|
|
40
|
-
proxysqlHealth = 'healthy';
|
|
41
|
-
await proxysql.close();
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
proxysqlHealth = 'unreachable';
|
|
45
|
-
}
|
|
46
|
-
healthData.components.ProxySQL = proxysqlHealth;
|
|
47
|
-
// Check Prometheus
|
|
48
|
-
let prometheusHealth;
|
|
49
|
-
try {
|
|
50
|
-
const response = await fetch(`${ctx.settings.prometheus.url}/-/healthy`);
|
|
51
|
-
prometheusHealth = response.ok ? 'healthy' : 'unhealthy';
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
prometheusHealth = 'unreachable';
|
|
55
|
-
}
|
|
56
|
-
healthData.components.Prometheus = prometheusHealth;
|
|
57
|
-
healthData.components['ClawSQL API'] = 'healthy';
|
|
58
|
-
// Output JSON if requested
|
|
59
|
-
if (ctx.outputFormat === 'json') {
|
|
60
|
-
// Get cluster health for JSON output
|
|
61
|
-
try {
|
|
62
|
-
const clusters = await orchestrator.getClusters();
|
|
63
|
-
for (const clusterName of clusters) {
|
|
64
|
-
const cluster = await orchestrator.getTopology(clusterName);
|
|
65
|
-
if (cluster) {
|
|
66
|
-
const primaryOk = cluster.primary?.state === 'online';
|
|
67
|
-
const replicaCount = cluster.replicas.length;
|
|
68
|
-
const healthyReplicas = cluster.replicas.filter(r => r.state === 'online').length;
|
|
69
|
-
healthData.clusters.push({
|
|
70
|
-
name: clusterName,
|
|
71
|
-
status: primaryOk && healthyReplicas === replicaCount ? 'ok' : 'degraded',
|
|
72
|
-
replicas: `${healthyReplicas}/${replicaCount}`,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
// Ignore errors getting cluster health
|
|
79
|
-
}
|
|
80
|
-
console.log(JSON.stringify(healthData, null, 2));
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
// Table output
|
|
84
|
-
console.log(formatter.header('System Health'));
|
|
85
|
-
console.log(formatter.keyValue('Orchestrator', colorStatus(orchestratorHealth)));
|
|
86
|
-
console.log(formatter.keyValue('ProxySQL', colorStatus(proxysqlHealth)));
|
|
87
|
-
console.log(formatter.keyValue('Prometheus', colorStatus(prometheusHealth)));
|
|
88
|
-
console.log(formatter.keyValue('ClawSQL API', chalk_1.default.green('healthy')));
|
|
89
|
-
// Try to get cluster health
|
|
90
|
-
try {
|
|
91
|
-
const clusters = await orchestrator.getClusters();
|
|
92
|
-
if (clusters.length > 0) {
|
|
93
|
-
console.log('\n' + formatter.section('Cluster Health'));
|
|
94
|
-
for (const clusterName of clusters) {
|
|
95
|
-
const cluster = await orchestrator.getTopology(clusterName);
|
|
96
|
-
if (cluster) {
|
|
97
|
-
const primaryOk = cluster.primary?.state === 'online';
|
|
98
|
-
const replicaCount = cluster.replicas.length;
|
|
99
|
-
const healthyReplicas = cluster.replicas.filter(r => r.state === 'online').length;
|
|
100
|
-
const status = primaryOk && healthyReplicas === replicaCount
|
|
101
|
-
? chalk_1.default.green('ok')
|
|
102
|
-
: chalk_1.default.yellow('degraded');
|
|
103
|
-
console.log(` ${clusterName}: ${status} (${healthyReplicas}/${replicaCount} replicas)`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
// Ignore errors getting cluster health
|
|
110
|
-
}
|
|
111
|
-
console.log();
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Colorize status string
|
|
116
|
-
*/
|
|
117
|
-
function colorStatus(status) {
|
|
118
|
-
if (status === 'healthy')
|
|
119
|
-
return chalk_1.default.green(status);
|
|
120
|
-
if (status === 'unreachable' || status === 'unhealthy')
|
|
121
|
-
return chalk_1.default.red(status);
|
|
122
|
-
return chalk_1.default.yellow(status);
|
|
123
|
-
}
|
|
124
|
-
exports.default = exports.healthCommand;
|
|
125
|
-
//# sourceMappingURL=health.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/cli/commands/health.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAGH,kDAA0B;AAE1B;;GAEG;AACU,QAAA,aAAa,GAAY;IACpC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE,qBAAqB;IAC5B,OAAO,EAAE,KAAK,EAAE,KAAe,EAAE,GAAe,EAAE,EAAE;QAClD,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAChC,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;QACtC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE9B,sBAAsB;QACtB,MAAM,UAAU,GAGZ,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QAErC,qBAAqB;QACrB,IAAI,kBAA0B,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC;YACnD,kBAAkB,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;QAC3D,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB,GAAG,aAAa,CAAC;QACrC,CAAC;QACD,UAAU,CAAC,UAAU,CAAC,YAAY,GAAG,kBAAkB,CAAC;QAExD,iBAAiB;QACjB,IAAI,cAAsB,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YACzB,cAAc,GAAG,SAAS,CAAC;YAC3B,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
-- MySQL Primary Initialization Script
|
|
2
|
-
-- This script runs on the primary MySQL instance startup
|
|
3
|
-
|
|
4
|
-
-- Create replication user with mysql_native_password for compatibility
|
|
5
|
-
CREATE USER IF NOT EXISTS 'repl'@'%' IDENTIFIED WITH mysql_native_password BY 'replpassword';
|
|
6
|
-
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
|
|
7
|
-
|
|
8
|
-
-- Create monitoring user for Orchestrator
|
|
9
|
-
CREATE USER IF NOT EXISTS 'orchestrator'@'%' IDENTIFIED WITH mysql_native_password BY 'orchestratorpassword';
|
|
10
|
-
GRANT SUPER, PROCESS, REPLICATION SLAVE, RELOAD ON *.* TO 'orchestrator'@'%';
|
|
11
|
-
GRANT SELECT ON mysql.slave_master_info TO 'orchestrator'@'%';
|
|
12
|
-
|
|
13
|
-
-- Create monitoring user for ClawSQL
|
|
14
|
-
CREATE USER IF NOT EXISTS 'clawsql_monitor'@'%' IDENTIFIED WITH mysql_native_password BY 'monitorpassword';
|
|
15
|
-
GRANT SELECT, PROCESS, REPLICATION CLIENT ON *.* TO 'clawsql_monitor'@'%';
|
|
16
|
-
|
|
17
|
-
-- Create application database
|
|
18
|
-
CREATE DATABASE IF NOT EXISTS clawsql;
|
|
19
|
-
CREATE DATABASE IF NOT EXISTS sbtest;
|
|
20
|
-
|
|
21
|
-
-- Create application user
|
|
22
|
-
CREATE USER IF NOT EXISTS 'app'@'%' IDENTIFIED WITH mysql_native_password BY 'apppassword';
|
|
23
|
-
GRANT ALL PRIVILEGES ON clawsql.* TO 'app'@'%';
|
|
24
|
-
GRANT ALL PRIVILEGES ON sbtest.* TO 'app'@'%';
|
|
25
|
-
|
|
26
|
-
FLUSH PRIVILEGES;
|
package/docker/init/replica.sql
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
-- MySQL Replica Initialization Script
|
|
2
|
-
-- This script runs on replica MySQL instances startup
|
|
3
|
-
|
|
4
|
-
-- Stop any existing replication
|
|
5
|
-
STOP SLAVE;
|
|
6
|
-
|
|
7
|
-
-- Configure replication to primary
|
|
8
|
-
CHANGE MASTER TO
|
|
9
|
-
MASTER_HOST='mysql-primary',
|
|
10
|
-
MASTER_PORT=3306,
|
|
11
|
-
MASTER_USER='repl',
|
|
12
|
-
MASTER_PASSWORD='replpassword',
|
|
13
|
-
MASTER_AUTO_POSITION=1;
|
|
14
|
-
|
|
15
|
-
-- Start replication
|
|
16
|
-
START SLAVE;
|