Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Login <[email protected]>
  • Loading branch information
batazor committed Nov 30, 2024
1 parent cdd2562 commit 5b4dc6b
Show file tree
Hide file tree
Showing 28 changed files with 65 additions and 175 deletions.
10 changes: 4 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ DOCKER_NETWORK=simple
### GitLab -------------------------------------------------------------------------------------------------------------
GITLAB_HOME=/data/gitlab

### Logger -------------------------------------------------------------------------------------------------------------
### Select: loki, fluent-bit
LOGGER_DRIVER=loki
LOGGER_DRIVER_URL=http://localhost:3100/loki/api/v1/push
LOGGER_MAX_SIZE=24m

### Airflow ------------------------------------------------------------------------------------------------------------
AIRFLOW_UID=50000

Expand All @@ -159,3 +153,7 @@ PROMETHEUS_PASSWORD=admin
OPENTELEMETRY_URI=http://localhost:4317
OPENTELEMETRY_USERNAME=admin
OPENTELEMETRY_PASSWORD=admin

TEMPO_URI=http://localhost:3100/tempo/api/v1/push
TEMPO_USERNAME=admin
TEMPO_PASSWORD=admin
2 changes: 1 addition & 1 deletion .run/auth.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
<filePath value="$PROJECT_DIR$/boundaries/auth/auth/cmd/auth.go" />
<method v="2" />
</configuration>
</component>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ x-json-schema-faker:

info:
version: 0.1.0
title: ShortLink API
title: ShortLink API (LINK BFF)
description: |
ShortLink API for managing and retrieving short links.
contact:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ info:
license:
name: MIT
url: http://www.opensource.org/licenses/MIT
title: ShortLink API
title: ShortLink (LINK BFF)
version: 0.1.0
servers:
- description: Local server
Expand Down
6 changes: 6 additions & 0 deletions boundaries/link/link/ops/Makefile/dev.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ dev: ### Run the development environment
-f $(ROOT_DIR)/ops/docker-compose/database/redis/redis.yaml \
-f $(ROOT_DIR)/ops/docker-compose/database/postgres/postgres.yaml \
-f $(ROOT_DIR)/ops/docker-compose/tooling/minio/minio.yaml \
-f $(ROOT_DIR)/ops/docker-compose/application/auth/kratos/kratos.yaml \
-f $(ROOT_DIR)/ops/docker-compose/application/auth/spicedb/spicedb.yaml \
-f $(ROOT_DIR)/ops/docker-compose/gateway/traefik/traefik.yaml \
up -d --remove-orphans --build

down: confirm ## Down docker compose
Expand All @@ -18,5 +21,8 @@ down: confirm ## Down docker compose
-f $(ROOT_DIR)/ops/docker-compose/database/redis/redis.yaml \
-f $(ROOT_DIR)/ops/docker-compose/database/postgres/postgres.yaml \
-f $(ROOT_DIR)/ops/docker-compose/tooling/minio/minio.yaml \
-f $(ROOT_DIR)/ops/docker-compose/application/auth/kratos/kratos.yaml \
-f $(ROOT_DIR)/ops/docker-compose/application/auth/spicedb/spicedb.yaml \
-f $(ROOT_DIR)/ops/docker-compose/gateway/traefik/traefik.yaml \
down --remove-orphans
@docker network prune -f
10 changes: 5 additions & 5 deletions boundaries/ui-monorepo/packages/next/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import React, { useRef, Suspense } from 'react'
import CssBaseline from '@mui/material/CssBaseline'
import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter'
import { CssVarsProvider } from '@mui/material/styles'
import { AppRouterCacheProvider } from '@mui/material-nextjs/v15-appRouter'
import { ThemeProvider } from '@mui/material/styles'
import InitColorSchemeScript from '@mui/material/InitColorSchemeScript'
import { theme } from '@shortlink-org/ui-kit'
import { LocalizationProvider } from '@mui/x-date-pickers'
Expand Down Expand Up @@ -49,9 +49,9 @@ function Providers({ children, ...props }) {
}

return (
<AppRouterCacheProvider>
<AppRouterCacheProvider options={{ enableCssLayer: true }}>
<NextThemeProvider enableSystem attribute="class" defaultTheme={'light'}>
<CssVarsProvider theme={theme}>
<ThemeProvider theme={theme}>
<InitColorSchemeScript />

{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
Expand All @@ -68,7 +68,7 @@ function Providers({ children, ...props }) {
</div>
</Layout>
</LocalizationProvider>
</CssVarsProvider>
</ThemeProvider>
</NextThemeProvider>
</AppRouterCacheProvider>
)
Expand Down
52 changes: 26 additions & 26 deletions boundaries/ui-monorepo/packages/next/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,50 @@ import React, { useEffect, useState } from 'react'
// @ts-ignore
import { ScrollToTopButton, Sidebar } from '@shortlink-org/ui-kit'

import PushNotificationLayout from 'components/PushNotificationLayout'
// import PushNotificationLayout from 'components/PushNotificationLayout'
import Footer from 'components/Footer'
import Header from 'components/Header'
import ory from '../pkg/sdk'
import { AxiosError } from 'axios'

// @ts-ignore
export function Layout({ children }) {
const [session, setSession] = useState<string>('No valid Ory Session was found.\nPlease sign in to receive one.')
const [hasSession, setHasSession] = useState<boolean>(false)
const [open, setOpen] = useState(false)

useEffect(() => {
ory
.toSession()
.then(({ data }) => {
setSession(JSON.stringify(data, null, 2))
setHasSession(true)
})
.catch((err: AxiosError) =>
// Something else happened!
Promise.reject(err),
)
}, [])
// const [session, setSession] = useState<string>('No valid Ory Session was found.\nPlease sign in to receive one.')
// const [hasSession, setHasSession] = useState<boolean>(false)
// const [open, setOpen] = useState(false)
//
// useEffect(() => {
// ory
// .toSession()
// .then(({ data }) => {
// setSession(JSON.stringify(data, null, 2))
// setHasSession(true)
// })
// .catch((err: AxiosError) =>
// // Something else happened!
// Promise.reject(err),
// )
// }, [])

return (
<PushNotificationLayout>
<>
<CssBaseline />

<div className="grid grid-rows-[auto_1fr] h-screen overflow-hidden">
<Header hasSession={hasSession} setOpen={() => setOpen(!open)} />
{/*<Header hasSession={hasSession} setOpen={() => setOpen(!open)} />*/}

<main className={'grid grid-cols-[auto_1fr] min-h-0'}>
<div className={'h-full overflow-auto'}>{hasSession && <Sidebar mode={open ? 'full' : 'mini'} />}</div>
{/*<div className={'h-full overflow-auto'}>{hasSession && <Sidebar mode={open ? 'full' : 'mini'} />}</div>*/}

<div className="overflow-auto h-full">
{children}
{/*<div className="overflow-auto h-full">*/}
{/* {children}*/}

<Footer />
{/* <Footer />*/}

<ScrollToTopButton />
</div>
{/* <ScrollToTopButton />*/}
{/*</div>*/}
</main>
</div>
</PushNotificationLayout>
</>
)
}
1 change: 0 additions & 1 deletion boundaries/ui-monorepo/packages/next/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ const NEXT_CONFIG = {
bundlePagesRouterDependencies: true,
experimental: {
webVitalsAttribution: ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'],
turbo: {},
// typedRoutes: true,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ const searchClient = algoliasearch('YourApplicationID', 'YourSearchOnlyAPIKey')

function SearchForm() {
return (
<InstantSearch searchClient={searchClient} indexName="instant_search" insights>
<InstantSearch
searchClient={searchClient}
future={{
preserveSharedStateOnUnmount: true,
}}
indexName="instant_search"
insights
>
<SearchBox
placeholder="Product, brand, color, …"
classNames={{
Expand Down
Binary file modified docs/shortlink-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 0 additions & 40 deletions docs/tutorial/logger.md

This file was deleted.

5 changes: 0 additions & 5 deletions ops/docker-compose/application/api/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ x-network: &network
dns:
- ${DNS_IP}
dns_search: ${DNS_SEARCH}
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

services:

Expand Down
5 changes: 0 additions & 5 deletions ops/docker-compose/application/link/link.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ x-network: &network
dns:
- ${DNS_IP}
dns_search: ${DNS_SEARCH}
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

services:

Expand Down
5 changes: 0 additions & 5 deletions ops/docker-compose/application/logger/logger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ x-network: &network
dns:
- ${DNS_IP}
dns_search: ${DNS_SEARCH}
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

services:

Expand Down
5 changes: 0 additions & 5 deletions ops/docker-compose/application/metadata/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ x-network: &network
dns:
- ${DNS_IP}
dns_search: ${DNS_SEARCH}
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

services:

Expand Down
5 changes: 0 additions & 5 deletions ops/docker-compose/application/support/support.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ x-network: &network
dns:
- ${DNS_IP}
dns_search: ${DNS_SEARCH}
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

services:

Expand Down
5 changes: 0 additions & 5 deletions ops/docker-compose/application/ui-next/ui-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ x-network: &network
dns:
- ${DNS_IP}
dns_search: ${DNS_SEARCH}
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

services:

Expand Down
8 changes: 0 additions & 8 deletions ops/docker-compose/gateway/traefik/conf/traefik-target.json

This file was deleted.

7 changes: 3 additions & 4 deletions ops/docker-compose/gateway/traefik/conf/traefik.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,12 @@
[tracing]
serviceName = "traefik"

# Default: 0 - no truncation will occur
spanNameLimit = 0

[tracing.otlp.http]
endpoint = "http://jaeger-agent:4318/v1/traces"

[tracing.openTelemetry.grpc]
[tracing.otlp.grpc]
insecure = true
endpoint = "http://jaeger-agent:4317"

################################################################
# Prometheus
Expand Down
15 changes: 0 additions & 15 deletions ops/docker-compose/gateway/traefik/traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,3 @@ services:
- ./ops/docker-compose/gateway/traefik/conf/dynamic_conf.toml:/conf/dynamic_conf.toml
- ./ops/docker-compose/gateway/traefik/conf/traefik.toml:/traefik.toml
- ./ops/cert:/cert
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

prometheus:
<<: *network
depends_on:
- coredns
image: prom/prometheus:v3.0.1
profiles:
- prometheus
volumes:
- ./ops/docker-compose/gateway/traefik/conf/traefik-target.json:/etc/prometheus/targets/traefik-server.json
5 changes: 0 additions & 5 deletions ops/docker-compose/mq/rabbitmq/rabbitmq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,3 @@ services:
interval: 30s
timeout: 10s
retries: 3
# logging:
# driver: ${LOGGER_DRIVER}
# options:
# loki-url: ${LOGGER_DRIVER_URL}
# max-size: ${LOGGER_MAX_SIZE}
5 changes: 0 additions & 5 deletions ops/docker-compose/mq/redpanda/redpanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ services:
- 9092:9092
- 28082:28082
- 29092:29092
logging:
driver: ${LOGGER_DRIVER}
options:
loki-url: ${LOGGER_DRIVER_URL}
max-size: ${LOGGER_MAX_SIZE}

console:
<<: *network
Expand Down
Loading

0 comments on commit 5b4dc6b

Please sign in to comment.