Skip to content

Commit 316b8ec

Browse files
committed
fix: docker stuff 5 -d
1 parent 04b0482 commit 316b8ec

File tree

9 files changed

+403
-384
lines changed

9 files changed

+403
-384
lines changed

@fiction/analytics/plugin-clickhouse/index.ts

+18-10
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,28 @@ export class FictionClickHouse extends FictionPlugin<FictionClickHouseSettings>
8383
if (this.fictionEnv.isApp.value)
8484
return
8585

86-
if (!this.connectionUrl)
87-
throw new Error('no clickhouse connection url')
86+
try {
87+
if (!this.connectionUrl)
88+
throw new Error('no clickhouse connection url')
8889

89-
const check = await fetch(this.connectionUrl.href, { method: 'GET' })
90-
const checkText = await check.text()
90+
const check = await fetch(this.connectionUrl.href, { method: 'GET' })
91+
const checkText = await check.text()
9192

92-
if (checkText.trim() !== 'Ok.')
93-
throw new Error('clickhouse not alive')
93+
if (checkText.trim() !== 'Ok.')
94+
throw new Error('clickhouse not alive')
9495

95-
this.log.info('CLICKHOUSE INITIALIZED', { data: { url: this.connectionUrl.hostname, port: `[ ${this.connectionUrl.port} ]` } })
96-
this.initialized = true
96+
this.log.info('CLICKHOUSE INITIALIZED', { data: { url: this.connectionUrl.hostname, port: `[ ${this.connectionUrl.port} ]` } })
97+
this.initialized = true
9798

98-
if (!this.fictionEnv.isTest.value)
99-
await this.extend()
99+
if (!this.fictionEnv.isTest.value)
100+
await this.extend()
101+
}
102+
catch (error) {
103+
this.log.error('clickhouse init error', {
104+
error,
105+
data: { connectionUrl: this.connectionUrl.toString() },
106+
})
107+
}
100108
}
101109

102110
client(): Knex {

@fiction/core/plugin-env/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export type EnvEventMap = {
7878
fiveMinuteInterval: CustomEvent<{ reason: string }>
7979
hourlyInterval: CustomEvent<{ reason: string }>
8080
dailyInterval: CustomEvent<{ reason: string }>
81-
onNewOrganization: CustomEvent<{ org: Organization }>
81+
onNewOrganization: CustomEvent<{ org: Organization, userId: string }>
8282
}
8383

8484
export class FictionEnv<

@fiction/core/plugin-user/endpointOrg.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export class QueryManageOrganization extends OrgQuery {
263263
if (!responseOrg?.orgId)
264264
throw new Error('Organization creation failed')
265265

266-
this.settings.fictionEnv.events.emit('onNewOrganization', { org: responseOrg })
266+
this.settings.fictionEnv.events.emit('onNewOrganization', { org: responseOrg, userId })
267267

268268
await this.manageMemberRelation({ userId, orgId: responseOrg.orgId, accessType: 'owner' }, { server: true, ...meta, caller: 'orgCreateMemberRelationCall' })
269269

@fiction/posts/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ export class FictionPosts extends FictionPlugin<FictionPostsSettings> {
5656

5757
hooks() {
5858
this.fictionEnv.events.on('onNewOrganization', async (event) => {
59-
const { org: { orgId } } = event.detail
59+
const { org: { orgId }, userId } = event.detail
6060
if (!orgId)
6161
throw new Error('orgId not found')
62-
await createHelloWorldPost({ orgId, fictionPosts: this })
62+
await createHelloWorldPost({ orgId, fictionPosts: this, userId })
6363
})
6464
}
6565

@fiction/posts/utils/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ export async function managePostIndex(args: { fictionPosts: FictionPosts, params
2121
return r.data?.length ? r.data.map(p => new Post({ fictionPosts, ...p, sourceMode: 'standard' })) : []
2222
}
2323

24-
export async function createHelloWorldPost(args: { orgId: string, fictionPosts: FictionPosts }) {
25-
const { fictionPosts, orgId } = args
24+
export async function createHelloWorldPost(args: { orgId: string, userId: string, fictionPosts: FictionPosts }) {
25+
const { fictionPosts, orgId, userId } = args
2626

2727
const { createStockMediaHandler } = await import('@fiction/ui/stock')
2828
const stock = await createStockMediaHandler()
2929
await fictionPosts.queries.ManagePost.serve({
3030
_action: 'create',
3131
orgId,
32+
userId,
3233
fields: {
3334
title: 'Hello World',
3435
subTitle: 'Your first post to get things started',

@fiction/www/.fiction/cardStructure.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": "1.0",
3-
"generatedAt": "2025-02-07T07:02:40.466Z",
3+
"generatedAt": "2025-02-09T09:12:31.793Z",
44
"templates": [
55
{
66
"templateId": "cardHeroV1",

@fiction/www/.fiction/projectStructure.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -1605,14 +1605,14 @@
16051605
"InputUsername.vue": null,
16061606
"InputWeight.vue": null,
16071607
"LibraryBackground.vue": null,
1608-
"LibraryHtml.vue": null,
16091608
"LibraryIcon.vue": null,
1610-
"LibraryMedia.vue": null,
16111609
"LibraryMediaGallery.vue": null,
16121610
"LibraryModal copy.vue": null,
16131611
"LibraryModal.vue": null,
1614-
"LibraryModalOld.vue": null,
16151612
"__InputItems.vue": null,
1613+
"__LibraryHtml.vue": null,
1614+
"__LibraryMedia.vue": null,
1615+
"__LibraryModalOld.vue": null,
16161616
"index.ts": null,
16171617
"test": {
16181618
"InputArray.unit.test.ts": null,
@@ -1755,14 +1755,10 @@
17551755
"CHANGELOG.md": null,
17561756
"README.md": null,
17571757
"docker": {
1758-
"Dockerfile": null,
17591758
"clickhouse": {
1760-
"clickhouse-config.xml": null,
1761-
"clickhouse-init.sh": null,
1762-
"clickhouse.Dockerfile": null,
1759+
"config.xml": null,
17631760
"users.xml": null
17641761
},
1765-
"docker-compose.dev.yml": null,
17661762
"docker-compose.yml": null
17671763
},
17681764
"docs": {
@@ -1798,8 +1794,13 @@
17981794
"Dockerfile": null,
17991795
"andrewpowers.www.toml": null,
18001796
"chrome.Dockerfile": null,
1797+
"clickhouse": {
1798+
"Dockerfile": null,
1799+
"config.xml": null,
1800+
"fiction.clickhouse.toml": null,
1801+
"users.xml": null
1802+
},
18011803
"fiction.beacon.toml": null,
1802-
"fiction.clickhouse.toml": null,
18031804
"fiction.docs.toml": null,
18041805
"fiction.gateway.toml": null,
18051806
"fiction.proxy.toml": null,

0 commit comments

Comments
 (0)