mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-01 12:44:43 +00:00
Merge pull request #3566 from gradido/dlt_inspector_as_submodule
feat(dlt): add inspector as submodule, update nginx config to serve inspector and gradido node
This commit is contained in:
commit
b2f83f69b9
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1 +1,4 @@
|
||||
|
||||
[submodule "inspector"]
|
||||
path = inspector
|
||||
url = https://github.com/gradido/inspector.git
|
||||
|
||||
11
README.md
11
README.md
@ -20,6 +20,7 @@ Clone the Gradido repository to your local machine.
|
||||
```bash
|
||||
git clone https://github.com/gradido/gradido.git
|
||||
cd gradido
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
For local development, you can run Gradido with **Docker** or **natively**, depending on your preferences and system setup. If you don't have a native MariaDB or MySQL installation, Docker can be used to handle the database as well.
|
||||
@ -227,6 +228,16 @@ In root folder calling `bun clear` will clear all turbo caches, node_modules and
|
||||
bun clear
|
||||
```
|
||||
|
||||
### git Submodule
|
||||
The new Module `inspector` was added as git submodule.
|
||||
So after
|
||||
- `git clone`
|
||||
- `git checkout`
|
||||
- `git pull`
|
||||
|
||||
you have to run `git submodule update --init` to get the correct submodule version.
|
||||
|
||||
[Read More](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
|
||||
|
||||
## Services defined in this package
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Server
|
||||
PORT=4000
|
||||
BACKEND_PORT=4000
|
||||
JWT_SECRET=secret123
|
||||
JWT_EXPIRES_IN=10m
|
||||
GRAPHIQL=false
|
||||
@ -22,7 +22,7 @@ KLICKTIPP_APIKEY_DE=SomeFakeKeyDE
|
||||
KLICKTIPP_APIKEY_EN=SomeFakeKeyEN
|
||||
|
||||
# DltConnector
|
||||
DLT_CONNECTOR=true
|
||||
DLT_ACTIVE=false
|
||||
DLT_CONNECTOR_URL=http://localhost:6010
|
||||
|
||||
# Community
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
# must match the CONFIG_VERSION.EXPECTED definition in scr/config/index.ts
|
||||
CONFIG_VERSION=$BACKEND_CONFIG_VERSION
|
||||
|
||||
# Server
|
||||
JWT_SECRET=$JWT_SECRET
|
||||
JWT_EXPIRES_IN=$JWT_EXPIRES_IN
|
||||
GRAPHIQL=false
|
||||
GDT_API_URL=$GDT_API_URL
|
||||
BACKEND_PORT=$BACKEND_PORT
|
||||
|
||||
# Database
|
||||
DB_HOST=127.0.0.1
|
||||
@ -24,7 +24,7 @@ KLICKTIPP_APIKEY_DE=$KLICKTIPP_APIKEY_DE
|
||||
KLICKTIPP_APIKEY_EN=$KLICKTIPP_APIKEY_EN
|
||||
|
||||
# DltConnector
|
||||
DLT_CONNECTOR=$DLT_CONNECTOR
|
||||
DLT_ACTIVE=$DLT_ACTIVE
|
||||
DLT_CONNECTOR_PORT=$DLT_CONNECTOR_PORT
|
||||
|
||||
# Community
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
# Server
|
||||
JWT_EXPIRES_IN=2m
|
||||
BACKEND_PORT=4000
|
||||
|
||||
GDT_ACTIVE=false
|
||||
HUMHUB_ACTIVE=false
|
||||
|
||||
@ -17,7 +17,7 @@ ENV BUILD_COMMIT="0000000"
|
||||
## SET NODE_ENV
|
||||
ENV NODE_ENV=production
|
||||
## App relevant Envs
|
||||
ENV PORT="4000"
|
||||
ENV BACKEND_PORT="4000"
|
||||
## Timezone
|
||||
ENV TZ=UTC
|
||||
ENV DB_HOST=mariadb
|
||||
@ -42,7 +42,7 @@ LABEL maintainer="support@gradido.net"
|
||||
|
||||
# Settings
|
||||
## Expose Container Port
|
||||
EXPOSE ${PORT}
|
||||
EXPOSE ${BACKEND_PORT}
|
||||
|
||||
## Workdir
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
|
||||
@ -5,17 +5,17 @@ import { DltConnectorClient } from './DltConnectorClient'
|
||||
describe('undefined DltConnectorClient', () => {
|
||||
it('invalid url', () => {
|
||||
CONFIG.DLT_CONNECTOR_URL = ''
|
||||
CONFIG.DLT_CONNECTOR = true
|
||||
CONFIG.DLT_ACTIVE = true
|
||||
const result = DltConnectorClient.getInstance()
|
||||
expect(result).toBeUndefined()
|
||||
CONFIG.DLT_CONNECTOR_URL = 'http://dlt-connector:6010'
|
||||
})
|
||||
|
||||
it('DLT_CONNECTOR is false', () => {
|
||||
CONFIG.DLT_CONNECTOR = false
|
||||
it('DLT_ACTIVE is false', () => {
|
||||
CONFIG.DLT_ACTIVE = false
|
||||
const result = DltConnectorClient.getInstance()
|
||||
expect(result).toBeUndefined()
|
||||
CONFIG.DLT_CONNECTOR = true
|
||||
CONFIG.DLT_ACTIVE = true
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ export class DltConnectorClient {
|
||||
* just one instance of each subclass around.
|
||||
*/
|
||||
public static getInstance(): DltConnectorClient | undefined {
|
||||
if (!CONFIG.DLT_CONNECTOR || !CONFIG.DLT_CONNECTOR_URL) {
|
||||
if (!CONFIG.DLT_ACTIVE || !CONFIG.DLT_CONNECTOR_URL) {
|
||||
logger.info(`dlt-connector are disabled via config...`)
|
||||
return
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ export class DltConnectorClient {
|
||||
* just one instance of each subclass around.
|
||||
*/
|
||||
public static getInstance(): DltConnectorClient | undefined {
|
||||
if (!CONFIG.DLT_CONNECTOR || !CONFIG.DLT_CONNECTOR_URL) {
|
||||
if (!CONFIG.DLT_ACTIVE || !CONFIG.DLT_CONNECTOR_URL) {
|
||||
logger.info(`dlt-connector are disabled via config...`)
|
||||
return
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ async function executeDltTransaction(draft: TransactionDraft | null, typeId: Dlt
|
||||
* and update dltTransactionId of transaction in db with hiero transaction id
|
||||
*/
|
||||
export async function registerAddressTransaction(user: DbUser, community: DbCommunity): Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
if (!CONFIG.DLT_ACTIVE) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
if (!user.id) {
|
||||
@ -88,7 +88,7 @@ export async function contributionTransaction(
|
||||
signingUser: DbUser,
|
||||
createdAt: Date,
|
||||
): Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
if (!CONFIG.DLT_ACTIVE) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
const homeCommunity = await getHomeCommunity()
|
||||
@ -107,7 +107,7 @@ export async function transferTransaction(
|
||||
memo: string,
|
||||
createdAt: Date
|
||||
): Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
if (!CONFIG.DLT_ACTIVE) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
// load community if not already loaded, maybe they are remote communities
|
||||
@ -125,7 +125,7 @@ export async function transferTransaction(
|
||||
|
||||
export async function deferredTransferTransaction(senderUser: DbUser, transactionLink: DbTransactionLink)
|
||||
: Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
if (!CONFIG.DLT_ACTIVE) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
// load community if not already loaded
|
||||
@ -138,7 +138,7 @@ export async function deferredTransferTransaction(senderUser: DbUser, transactio
|
||||
|
||||
export async function redeemDeferredTransferTransaction(transactionLink: DbTransactionLink, amount: string, createdAt: Date, recipientUser: DbUser)
|
||||
: Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
if (!CONFIG.DLT_ACTIVE) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
// load user and communities if not already loaded
|
||||
|
||||
@ -16,7 +16,8 @@ const logging = {
|
||||
}
|
||||
|
||||
const server = {
|
||||
PORT: process.env.PORT ?? 4000,
|
||||
BACKEND_PORT: process.env.BACKEND_PORT ?? 4000,
|
||||
DLT_ACTIVE: process.env.DLT_ACTIVE === 'true' || false,
|
||||
JWT_SECRET: process.env.JWT_SECRET ?? 'secret123',
|
||||
JWT_EXPIRES_IN: process.env.JWT_EXPIRES_IN ?? '10m',
|
||||
REDEEM_JWT_TOKEN_EXPIRATION: process.env.REDEEM_JWT_TOKEN_EXPIRATION ?? '10m',
|
||||
@ -41,9 +42,7 @@ const COMMUNITY_URL = process.env.COMMUNITY_URL ?? `${URL_PROTOCOL}://${COMMUNIT
|
||||
const DLT_CONNECTOR_PORT = process.env.DLT_CONNECTOR_PORT ?? 6010
|
||||
|
||||
const dltConnector = {
|
||||
DLT_CONNECTOR: process.env.DLT_CONNECTOR === 'true' || false,
|
||||
DLT_CONNECTOR_URL: process.env.DLT_CONNECTOR_URL ?? `${COMMUNITY_URL}:${DLT_CONNECTOR_PORT}`,
|
||||
DLT_GRADIDO_NODE_SERVER_HOME_FOLDER: process.env.DLT_GRADIDO_NODE_SERVER_HOME_FOLDER ?? '~/.gradido',
|
||||
}
|
||||
|
||||
const community = {
|
||||
|
||||
@ -4,6 +4,7 @@ import {
|
||||
COMMUNITY_SUPPORT_MAIL,
|
||||
COMMUNITY_URL,
|
||||
DECAY_START_TIME,
|
||||
DLT_ACTIVE,
|
||||
GDT_ACTIVE,
|
||||
GDT_API_URL,
|
||||
GMS_ACTIVE,
|
||||
@ -27,6 +28,7 @@ export const schema = Joi.object({
|
||||
COMMUNITY_DESCRIPTION,
|
||||
COMMUNITY_SUPPORT_MAIL,
|
||||
DECAY_START_TIME,
|
||||
DLT_ACTIVE,
|
||||
GDT_API_URL,
|
||||
GDT_ACTIVE,
|
||||
GMS_ACTIVE,
|
||||
@ -68,20 +70,11 @@ export const schema = Joi.object({
|
||||
.default('http://0.0.0.0/redeem/CL-')
|
||||
.required(),
|
||||
|
||||
DLT_CONNECTOR: Joi.boolean()
|
||||
.description('Flag to indicate if DLT-Connector is used. (Still in development)')
|
||||
.default(false)
|
||||
.required(),
|
||||
|
||||
DLT_CONNECTOR_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.default('http://localhost:6010')
|
||||
.when('DLT_CONNECTOR', { is: true, then: Joi.required() })
|
||||
.description('The URL for GDT API endpoint'),
|
||||
|
||||
DLT_GRADIDO_NODE_SERVER_HOME_FOLDER: Joi.string()
|
||||
.default('~/.gradido')
|
||||
.description('The home folder for the gradido dlt node server'),
|
||||
.when('DLT_ACTIVE', { is: true, then: Joi.required() })
|
||||
.description('The URL for DLT connector'),
|
||||
|
||||
EMAIL_LINK_VERIFICATION: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
@ -179,7 +172,7 @@ export const schema = Joi.object({
|
||||
})
|
||||
.description('JWT key for HumHub integration, must be the same as configured in humhub'),
|
||||
|
||||
PORT: Joi.number()
|
||||
BACKEND_PORT: Joi.number()
|
||||
.integer()
|
||||
.min(1024)
|
||||
.max(49151)
|
||||
|
||||
@ -42,7 +42,7 @@ const logErrorLogger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.server.LogError`)
|
||||
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
CONFIG.DLT_CONNECTOR = false
|
||||
CONFIG.DLT_ACTIVE = false
|
||||
|
||||
// mock semaphore to allow use fake timers
|
||||
// jest.mock('database/src/util/TRANSACTIONS_LOCK')
|
||||
|
||||
@ -40,7 +40,7 @@ import { AppDatabase } from 'database'
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.server.LogError`)
|
||||
CONFIG.DLT_CONNECTOR = false
|
||||
CONFIG.DLT_ACTIVE = false
|
||||
CORE_CONFIG.EMAIL = false
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
|
||||
@ -119,7 +119,7 @@ beforeAll(async () => {
|
||||
con = testEnv.con
|
||||
db = testEnv.db
|
||||
CONFIG.HUMHUB_ACTIVE = false
|
||||
CONFIG.DLT_CONNECTOR = false
|
||||
CONFIG.DLT_ACTIVE = false
|
||||
await cleanDB()
|
||||
})
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ import { AppDatabase } from 'database'
|
||||
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
CONFIG.DLT_CONNECTOR = false
|
||||
CONFIG.DLT_ACTIVE = false
|
||||
CORE_CONFIG.EMAIL = false
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
|
||||
@ -12,12 +12,12 @@ async function main() {
|
||||
const { app } = await createServer(getLogger('apollo'))
|
||||
|
||||
await writeJwtKeyPairInHomeCommunity()
|
||||
app.listen(CONFIG.PORT, () => {
|
||||
app.listen(CONFIG.BACKEND_PORT, () => {
|
||||
// biome-ignore lint/suspicious/noConsole: no need for logging the start message
|
||||
console.log(`Server is running at http://localhost:${CONFIG.PORT}`)
|
||||
console.log(`Server is running at http://localhost:${CONFIG.BACKEND_PORT}`)
|
||||
if (CONFIG.GRAPHIQL) {
|
||||
// biome-ignore lint/suspicious/noConsole: no need for logging the start message
|
||||
console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`)
|
||||
console.log(`GraphIQL available at http://localhost:${CONFIG.BACKEND_PORT}`)
|
||||
}
|
||||
})
|
||||
await startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER))
|
||||
|
||||
@ -35,6 +35,11 @@ export const COMMUNITY_URL = Joi.string()
|
||||
.default('http://0.0.0.0')
|
||||
.required()
|
||||
|
||||
export const DLT_ACTIVE = Joi.boolean()
|
||||
.description('Flag to indicate if the DLT (Decentralized Ledger Technology) service is used.')
|
||||
.default(false)
|
||||
.required()
|
||||
|
||||
export const GRAPHQL_URI = Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.description(
|
||||
|
||||
@ -12,6 +12,8 @@ EMAIL_PASSWORD=1234
|
||||
EMAIL_SMTP_HOST=smtp.lustig.de
|
||||
EMAIL_SMTP_PORT=587
|
||||
|
||||
BACKEND_PORT=4000
|
||||
|
||||
# if set to true allow sending gradidos to another communities
|
||||
FEDERATION_XCOM_SENDCOINS_ENABLED=false
|
||||
|
||||
@ -85,9 +87,14 @@ FEDERATION_COMMUNITY_APIS=1_0
|
||||
# externe gradido services (more added in future)
|
||||
GDT_ACTIVE=false
|
||||
|
||||
AUTO_POLL_INTERVAL=30000
|
||||
|
||||
# DLT-Connector (still in develop)
|
||||
DLT_CONNECTOR=false
|
||||
DLT_ACTIVE=false
|
||||
DLT_CONNECTOR_PORT=6010
|
||||
DLT_NODE_SERVER_PORT=8340
|
||||
DLT_NODE_SERVER_URL=$URL_PROTOCOL://$COMMUNITY_HOST/dlt
|
||||
DLT_GRADIDO_NODE_SERVER_VERSION=0.9.0
|
||||
DLT_GRADIDO_NODE_SERVER_HOME_FOLDER=/home/gradido/.gradido
|
||||
|
||||
# used for combining a newsletter on klicktipp with this gradido community
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
# Blockchain Explorer
|
||||
location /inspector {
|
||||
limit_req zone=frontend burst=30 nodelay;
|
||||
limit_conn addr 20;
|
||||
alias $PROJECT_ROOT/inspector/build/;
|
||||
index index.html;
|
||||
|
||||
# caching rules for assets
|
||||
# static assets
|
||||
location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ {
|
||||
# keep assets for a week
|
||||
add_header Cache-Control "public, max-age=604800";
|
||||
try_files $uri =404;
|
||||
}
|
||||
# hashed assets
|
||||
location ~* \.(?:js|css|json)$ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
try_files $uri $uri/ /index.html = 404;
|
||||
|
||||
# don't cache index.html
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires 0;
|
||||
|
||||
access_log $GRADIDO_LOG_PATH/nginx-access.inspector.log gradido_log;
|
||||
error_log $GRADIDO_LOG_PATH/nginx-error.inspector.log warn;
|
||||
}
|
||||
|
||||
# Gradido-Node
|
||||
location /dlt {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_pass http://127.0.0.1:$DLT_NODE_SERVER_PORT/api;
|
||||
proxy_redirect off;
|
||||
|
||||
access_log $GRADIDO_LOG_PATH/nginx-access.dlt.log gradido_log;
|
||||
error_log $GRADIDO_LOG_PATH/nginx-error.dlt.log warn;
|
||||
}
|
||||
@ -196,6 +196,9 @@ server {
|
||||
access_log $GRADIDO_LOG_PATH/nginx-access.admin.log gradido_log;
|
||||
error_log $GRADIDO_LOG_PATH/nginx-error.admin.log warn;
|
||||
}
|
||||
|
||||
# dlt
|
||||
$DLT_NGINX_CONF
|
||||
|
||||
# Federation
|
||||
$FEDERATION_NGINX_CONF
|
||||
|
||||
@ -185,6 +185,7 @@ cd $PROJECT_ROOT
|
||||
git fetch --all
|
||||
git checkout $BRANCH_NAME
|
||||
git pull
|
||||
git submodule update --init --recursive
|
||||
export BUILD_COMMIT="$(git rev-parse HEAD)"
|
||||
|
||||
# install missing dependencies
|
||||
@ -213,6 +214,15 @@ unset FEDERATION_APIVERSION
|
||||
unset FEDERATION_PORT
|
||||
log_step "===================================================================================================="
|
||||
|
||||
export DLT_NGINX_CONF="${DLT_NGINX_CONF:-# dlt disabled}"
|
||||
# prepare inspector and gradido dlt node nginx config blocks if enabled
|
||||
if [ "$DLT_ACTIVE" = true ] ; then
|
||||
log_step "prepare inspector and dlt gradido node nginx config block"
|
||||
envsubst '$DLT_NODE_SERVER_PORT' < $NGINX_CONFIG_DIR/gradido-dlt.conf.template >> $NGINX_CONFIG_DIR/gradido-dlt.conf
|
||||
export DLT_NGINX_CONF=$(< $NGINX_CONFIG_DIR/gradido-dlt.conf)
|
||||
rm $NGINX_CONFIG_DIR/gradido-dlt.conf
|
||||
fi
|
||||
|
||||
# *** 2nd read gradido-federation.conf file in env variable to be replaced in 3rd step
|
||||
export FEDERATION_NGINX_CONF=$(< $NGINX_CONFIG_DIR/gradido-federation.conf.locations)
|
||||
|
||||
@ -222,8 +232,9 @@ case "$URL_PROTOCOL" in
|
||||
'https') TEMPLATE_FILE="gradido.conf.ssl.template" ;;
|
||||
*) TEMPLATE_FILE="gradido.conf.template" ;;
|
||||
esac
|
||||
envsubst '$FEDERATION_NGINX_CONF' < $NGINX_CONFIG_DIR/$TEMPLATE_FILE > $NGINX_CONFIG_DIR/gradido.conf.tmp
|
||||
envsubst '$FEDERATION_NGINX_CONF,$DLT_NGINX_CONF' < $NGINX_CONFIG_DIR/$TEMPLATE_FILE > $NGINX_CONFIG_DIR/gradido.conf.tmp
|
||||
unset FEDERATION_NGINX_CONF
|
||||
unset DLT_NGINX_CONF
|
||||
envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $NGINX_CONFIG_DIR/gradido.conf.tmp > $NGINX_CONFIG_DIR/gradido.conf
|
||||
rm $NGINX_CONFIG_DIR/gradido.conf.tmp
|
||||
rm $NGINX_CONFIG_DIR/gradido-federation.conf.locations
|
||||
@ -245,6 +256,10 @@ MODULES=(
|
||||
dht-node
|
||||
federation
|
||||
)
|
||||
if [ "$DLT_ACTIVE" = true ] ; then
|
||||
MODULES+=("inspector")
|
||||
MODULES+=("dlt-connector")
|
||||
fi
|
||||
|
||||
if [ "$FAST_MODE" = false ] ; then
|
||||
log_step 'Clean tmp, bun and yarn cache'
|
||||
@ -275,7 +290,10 @@ fi
|
||||
log_step 'Regenerate .env files'
|
||||
for dir in "${MODULES[@]}"; do
|
||||
base="$PROJECT_ROOT/$dir"
|
||||
cp -f $base/.env $base/.env.bak
|
||||
# Backup .env file if exists
|
||||
if [ -f "$base/.env" ]; then
|
||||
cp -f $base/.env $base/.env.bak
|
||||
fi
|
||||
envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $base/.env.template > $base/.env
|
||||
done
|
||||
|
||||
@ -287,6 +305,21 @@ bun install
|
||||
log_step 'build all modules'
|
||||
turbo build --env-mode=loose --concurrency=$(nproc)
|
||||
|
||||
# build inspector and dlt-connector
|
||||
if [ "$DLT_ACTIVE" = true ]; then
|
||||
log_step 'build inspector'
|
||||
cd $PROJECT_ROOT/inspector
|
||||
bun install
|
||||
bun run build
|
||||
|
||||
log_step 'build dlt-connector'
|
||||
cd $PROJECT_ROOT/dlt-connector
|
||||
bun install
|
||||
bun run build
|
||||
|
||||
cd $PROJECT_ROOT
|
||||
fi
|
||||
|
||||
# database
|
||||
log_step 'Updating database'
|
||||
if [ "$DEPLOY_SEED_DATA" = "true" ]; then
|
||||
@ -306,6 +339,14 @@ pm2 start --name gradido-backend \
|
||||
-l $GRADIDO_LOG_PATH/pm2.backend.$TODAY.log \
|
||||
--log-date-format 'YYYY-MM-DD HH:mm:ss.SSS'
|
||||
|
||||
if [ "$DLT_ACTIVE" = true ] ; then
|
||||
pm2 start --name dlt-connector \
|
||||
"env TZ=UTC NODE_ENV=production bun ./build/index.js" \
|
||||
--cwd $PROJECT_ROOT/dlt-connector \
|
||||
-l $GRADIDO_LOG_PATH/pm2.dlt-connector.$TODAY.log \
|
||||
--log-date-format 'YYYY-MM-DD HH:mm:ss.SSS'
|
||||
fi
|
||||
|
||||
pm2 save
|
||||
if [ ! -z $FEDERATION_DHT_TOPIC ]; then
|
||||
pm2 start --name gradido-dht-node \
|
||||
|
||||
@ -1,19 +1,20 @@
|
||||
CONFIG_VERSION=v6.2024-02-20
|
||||
|
||||
# SET LOG LEVEL AS NEEDED IN YOUR .ENV
|
||||
# POSSIBLE VALUES: all | trace | debug | info | warn | error | fatal
|
||||
# LOG_LEVEL=info
|
||||
|
||||
# IOTA
|
||||
IOTA_API_URL=https://chrysalis-nodes.iota.org
|
||||
IOTA_COMMUNITY_ALIAS=GRADIDO: TestHelloWelt2
|
||||
IOTA_HOME_COMMUNITY_SEED=aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899
|
||||
HOME_COMMUNITY_SEED=aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899
|
||||
|
||||
# DLT-Connector
|
||||
DLT_CONNECTOR_PORT=6010
|
||||
|
||||
# Gradido Node Server URL
|
||||
DLT_NODE_SERVER_PORT=8340
|
||||
DLT_GRADIDO_NODE_SERVER_VERSION=0.9.0
|
||||
|
||||
HIERO_ACTIVE=true
|
||||
HIERO_HEDERA_NETWORK=testnet
|
||||
HIERO_OPERATOR_ID="YOUR_OPERATOR_ID"
|
||||
HIERO_OPERATOR_KEY="YOUR_OPERATOR_ED25519_PRIVATE_KEY_IN_DER_FORMAT"
|
||||
|
||||
# Gradido Blockchain
|
||||
GRADIDO_BLOCKCHAIN_CRYPTO_APP_SECRET=21ffbbc616fe
|
||||
|
||||
25
dlt-connector/.env.template
Normal file
25
dlt-connector/.env.template
Normal file
@ -0,0 +1,25 @@
|
||||
# SET LOG LEVEL AS NEEDED IN YOUR .ENV
|
||||
# POSSIBLE VALUES: all | trace | debug | info | warn | error | fatal
|
||||
# LOG_LEVEL=info
|
||||
|
||||
HOME_COMMUNITY_SEED=$HOME_COMMUNITY_SEED
|
||||
|
||||
# DLT-Connector
|
||||
DLT_CONNECTOR_PORT=$DLT_CONNECTOR_PORT
|
||||
|
||||
# Gradido Node Server URL
|
||||
DLT_NODE_SERVER_PORT=$DLT_NODE_SERVER_PORT
|
||||
DLT_GRADIDO_NODE_SERVER_VERSION=$DLT_GRADIDO_NODE_SERVER_VERSION
|
||||
|
||||
HIERO_ACTIVE=$HIERO_ACTIVE
|
||||
HIERO_HEDERA_NETWORK=$HIERO_HEDERA_NETWORK
|
||||
HIERO_OPERATOR_ID=$HIERO_OPERATOR_ID
|
||||
HIERO_OPERATOR_KEY=$HIERO_OPERATOR_KEY
|
||||
|
||||
# Gradido Blockchain
|
||||
GRADIDO_BLOCKCHAIN_CRYPTO_APP_SECRET=$GRADIDO_BLOCKCHAIN_CRYPTO_APP_SECRET
|
||||
GRADIDO_BLOCKCHAIN_SERVER_CRYPTO_KEY=$GRADIDO_BLOCKCHAIN_SERVER_CRYPTO_KEY
|
||||
|
||||
# Route to Backend
|
||||
BACKEND_PORT=$BACKEND_PORT
|
||||
JWT_SECRET=$JWT_SECRET
|
||||
@ -30,7 +30,7 @@ export class BackendClient {
|
||||
*/
|
||||
private constructor() {
|
||||
this.logger = getLogger(`${LOG4JS_BASE_CATEGORY}.client.BackendClient`)
|
||||
this.urlValue = `http://localhost:${CONFIG.PORT}`
|
||||
this.urlValue = `http://localhost:${CONFIG.BACKEND_PORT}`
|
||||
this.logger.addContext('url', this.urlValue)
|
||||
|
||||
this.client = new GraphQLClient(this.urlValue, {
|
||||
|
||||
@ -80,14 +80,17 @@ export const configSchema = v.object({
|
||||
'8340',
|
||||
),
|
||||
DLT_GRADIDO_NODE_SERVER_VERSION: v.optional(
|
||||
v.string('The version of the DLT node server'),
|
||||
v.pipe(
|
||||
v.string('The version of the DLT node server, for example: 0.9.0'),
|
||||
v.regex(/^\d+\.\d+\.\d+$/),
|
||||
),
|
||||
'0.9.0',
|
||||
),
|
||||
DLT_GRADIDO_NODE_SERVER_HOME_FOLDER: v.optional(
|
||||
v.string('The home folder for the gradido dlt node server'),
|
||||
path.join(__dirname, '..', '..', 'gradido_node'),
|
||||
),
|
||||
PORT: v.optional(
|
||||
BACKEND_PORT: v.optional(
|
||||
v.pipe(
|
||||
v.string('A valid port on which the backend server is running'),
|
||||
v.transform<string, number>((input: string) => Number(input)),
|
||||
|
||||
@ -43,6 +43,26 @@ services:
|
||||
# bind the local folder to the docker to allow live reload
|
||||
- .:/app
|
||||
|
||||
########################################################
|
||||
# INSPECTOR ############################################
|
||||
########################################################
|
||||
inspector:
|
||||
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
||||
image: gradido/inspector:local-development
|
||||
build:
|
||||
target: development
|
||||
networks:
|
||||
- external-net
|
||||
- internal-net
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
volumes:
|
||||
# This makes sure the docker container has its own node modules.
|
||||
# Therefore it is possible to have a different node version on the host machine
|
||||
- node_modules_inspector:/app/node_modules
|
||||
# bind the local folder to the docker to allow live reload
|
||||
- .:/app
|
||||
|
||||
########################################################
|
||||
# BACKEND ##############################################
|
||||
########################################################
|
||||
@ -216,6 +236,7 @@ volumes:
|
||||
node_modules_frontend:
|
||||
node_modules_backend:
|
||||
node_modules_federation:
|
||||
node_modules_inspector:
|
||||
node_modules_database:
|
||||
node_modules_dlt_connector:
|
||||
turbo_cache:
|
||||
|
||||
@ -61,6 +61,30 @@ services:
|
||||
volumes:
|
||||
- ./logs/nginx/admin:/var/log/nginx
|
||||
|
||||
########################################################
|
||||
# INSPECTOR ###########################################
|
||||
########################################################
|
||||
inspector:
|
||||
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
||||
image: gradido/inspector:local-production
|
||||
build:
|
||||
context: ./inspector
|
||||
dockerfile: Dockerfile
|
||||
target: production
|
||||
networks:
|
||||
- internal-net
|
||||
ports:
|
||||
- ${INSPECTOR_MODULE_PORT:-3100}:3100
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- BUILD_COMMIT=${BUILD_COMMIT}
|
||||
- BUILD_COMMIT_SHORT=${BUILD_COMMIT_SHORT}
|
||||
- BUILD_VERSION=${BUILD_VERSION}
|
||||
# - DEBUG=true
|
||||
volumes:
|
||||
- ./logs/nginx/inspector:/var/log/nginx
|
||||
|
||||
|
||||
#########################################################
|
||||
## MARIADB ##############################################
|
||||
#########################################################
|
||||
@ -109,7 +133,7 @@ services:
|
||||
environment:
|
||||
# Envs used in Dockerfile
|
||||
# - DOCKER_WORKDIR="/app"
|
||||
# - PORT=4000
|
||||
- BACKEND_PORT=4000
|
||||
- BUILD_DATE
|
||||
- BUILD_VERSION
|
||||
- BUILD_COMMIT
|
||||
@ -144,7 +168,6 @@ services:
|
||||
environment:
|
||||
# Envs used in Dockerfile
|
||||
# - DOCKER_WORKDIR="/app"
|
||||
# - PORT=5000
|
||||
- BUILD_DATE
|
||||
- BUILD_VERSION
|
||||
- BUILD_COMMIT
|
||||
@ -179,7 +202,8 @@ services:
|
||||
environment:
|
||||
# Envs used in Dockerfile
|
||||
# - DOCKER_WORKDIR="/app"
|
||||
- PORT=6010
|
||||
- DLT_CONNECTOR_PORT=6010
|
||||
- BACKEND_PORT=4000
|
||||
- BUILD_DATE
|
||||
- BUILD_VERSION
|
||||
- BUILD_COMMIT
|
||||
|
||||
@ -43,6 +43,9 @@
|
||||
<BNavItem :href="`mailto:${supportEmail}`" target="_blank">
|
||||
{{ $t('navigation.support') }}
|
||||
</BNavItem>
|
||||
<BNavItem v-if="dltActive" :href="`https://${communityUrl}/inspector`" target="_blank">
|
||||
{{ $t('footer.inspector') }}
|
||||
</BNavItem>
|
||||
</BNav>
|
||||
</BCol>
|
||||
</BRow>
|
||||
@ -54,6 +57,8 @@ import CONFIG from '@/config'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dltActive: CONFIG.DLT_ACTIVE,
|
||||
communityUrl: CONFIG.COMMUNITY_URL,
|
||||
year: new Date().getFullYear(),
|
||||
version: CONFIG.APP_VERSION,
|
||||
hash: CONFIG.BUILD_COMMIT,
|
||||
|
||||
@ -38,6 +38,7 @@ if (process.env.FRONTEND_HOSTING === 'nodejs') {
|
||||
// version.FRONTEND_MODULE_PORT
|
||||
|
||||
const features = {
|
||||
DLT_ACTIVE: process.env.DLT_ACTIVE === 'true',
|
||||
GMS_ACTIVE: process.env.GMS_ACTIVE === 'true',
|
||||
HUMHUB_ACTIVE: process.env.HUMHUB_ACTIVE === 'true',
|
||||
AUTO_POLL_INTERVAL: Number.parseInt(process.env.AUTO_POLL_INTERVAL ?? 0),
|
||||
|
||||
@ -9,6 +9,7 @@ import {
|
||||
COMMUNITY_URL,
|
||||
DEBUG,
|
||||
DECAY_START_TIME,
|
||||
DLT_ACTIVE,
|
||||
GMS_ACTIVE,
|
||||
GRAPHQL_URI,
|
||||
HUMHUB_ACTIVE,
|
||||
@ -30,6 +31,7 @@ module.exports = Joi.object({
|
||||
COMMUNITY_URL,
|
||||
DEBUG,
|
||||
DECAY_START_TIME,
|
||||
DLT_ACTIVE,
|
||||
GMS_ACTIVE,
|
||||
GRAPHQL_URI,
|
||||
HUMHUB_ACTIVE,
|
||||
|
||||
@ -158,6 +158,7 @@
|
||||
"year": "© {year}"
|
||||
},
|
||||
"imprint": "Impressum",
|
||||
"inspector": "Inspektor (experimentell)",
|
||||
"privacy_policy": "Datenschutzerklärung",
|
||||
"short_hash": "({shortHash})",
|
||||
"whitepaper": "Whitepaper"
|
||||
|
||||
@ -158,6 +158,7 @@
|
||||
"year": "© {year}"
|
||||
},
|
||||
"imprint": "Legal notice",
|
||||
"inspector": "Inspector (experimental)",
|
||||
"privacy_policy": "Privacy policy",
|
||||
"short_hash": "({shortHash})",
|
||||
"whitepaper": "Whitepaper"
|
||||
|
||||
@ -140,6 +140,7 @@
|
||||
"year": "© {year}"
|
||||
},
|
||||
"imprint": "Aviso legal",
|
||||
"inspector": "Inspector (experimental)",
|
||||
"privacy_policy": "Protección de Datos",
|
||||
"short_hash": "({shortHash})",
|
||||
"whitepaper": "Whitepaper"
|
||||
|
||||
@ -145,6 +145,7 @@
|
||||
"year": "© {year}"
|
||||
},
|
||||
"imprint": "Notification légale",
|
||||
"inspector": "Inspecteur (expérimental)",
|
||||
"privacy_policy": "Politique de confidentialité",
|
||||
"short_hash": "({shortHash})",
|
||||
"whitepaper": "Papier blanc"
|
||||
|
||||
@ -140,6 +140,7 @@
|
||||
"year": "© {year}"
|
||||
},
|
||||
"imprint": "Colofon",
|
||||
"inspector": "Inspecteur (experimenteel)",
|
||||
"privacy_policy": "Privacyverklaring",
|
||||
"short_hash": "({shortHash})",
|
||||
"whitepaper": "Witboek"
|
||||
|
||||
@ -114,6 +114,7 @@ export default defineConfig(async ({ command }) => {
|
||||
AUTO_POLL_INTERVAL: CONFIG.AUTO_POLL_INTERVAL,
|
||||
BUILD_COMMIT: CONFIG.BUILD_COMMIT,
|
||||
CROSS_TX_REDEEM_LINK_ACTIVE: CONFIG.CROSS_TX_REDEEM_LINK_ACTIVE,
|
||||
DLT_ACTIVE: CONFIG.DLT_ACTIVE,
|
||||
GMS_ACTIVE: CONFIG.GMS_ACTIVE,
|
||||
HUMHUB_ACTIVE: CONFIG.HUMHUB_ACTIVE,
|
||||
DEFAULT_PUBLISHER_ID: null,
|
||||
|
||||
1
inspector
Submodule
1
inspector
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c7fc92da31e80a27558d3887543446079dc55b5e
|
||||
Loading…
x
Reference in New Issue
Block a user