Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ COPY ./libs ./libs
RUN npm ci --omit=dev --legacy-peer-deps \
&& npm cache clean --force


ENV NODE_ENV=production
ENV NODE_OPTIONS="--max-http-header-size=65536"

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

CMD ["npm", "run", "start:prod"]
CMD ["node", "dist/src/main"]
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.PHONY: bump-patch bump-minor bump-major help tag-release

# Default target
help:
@echo "Available targets:"
@echo " bump-patch - Bump patch version (x.x.X) and install dependencies"
@echo " bump-minor - Bump minor version (x.X.x) and install dependencies"
@echo " bump-major - Bump major version (X.x.x) and install dependencies"
@echo " tag-release - Create and push git tag for current version"

# Bump patch version (0.0.1 -> 0.0.2)
bump-patch:
@echo "Bumping patch version..."
npm version patch --no-git-tag-version
@echo "New version: $$(node -p "require('./package.json').version")"
npm install

# Bump minor version (0.1.0 -> 0.2.0)
bump-minor:
@echo "Bumping minor version..."
npm version minor --no-git-tag-version
@echo "New version: $$(node -p "require('./package.json').version")"
npm install
# Bump major version (1.0.0 -> 2.0.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Missing blank line after comment, inconsistent with formatting used for other targets

bump-major:
@echo "Bumping major version..."
npm version major --no-git-tag-version
@echo "New version: $$(node -p "require('./package.json').version")"
npm install

# Create and push git tag for current version
tag-release:
@VERSION=$$(node -p "require('./package.json').version") && \
echo "Creating signed tag for version $$VERSION..." && \
git tag -s "$$VERSION" -m "Release $$VERSION" && \
git push origin --follow-tags && \
echo "Signed tag $$VERSION created and pushed"





Comment on lines +39 to +42
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Remove unnecessary trailing blank lines

12 changes: 0 additions & 12 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,3 @@ services:
networks:
remnawave-node-dev:
external: false
# services:
# remnawave-node:
# container_name: remnawave-node
# hostname: remnawave-node
# build:
# context: .
# dockerfile: Dockerfile

# env_file:
# - .env
# ports:
# - 24000:24000
10 changes: 10 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
remnawave-node-local:
container_name: remnawave-node-local
hostname: remnawave-node-local
build:
context: .
dockerfile: Dockerfile
network_mode: host
env_file:
- .env
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remnawave/node",
"version": "2.1.2",
"version": "2.1.3",
"description": "Remnawave Node",
"private": false,
"type": "commonjs",
Expand Down Expand Up @@ -92,4 +92,4 @@
"tsconfig-paths": "^4.2.0",
"typescript": "~5.8.2"
}
}
}
19 changes: 17 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ async function bootstrap(): Promise<void> {
});

app.useGlobalPipes(new ZodValidationPipe());
app.enableShutdownHooks();

await app.listen(Number(config.getOrThrow<string>('APP_PORT')));

Expand All @@ -97,7 +96,23 @@ async function bootstrap(): Promise<void> {
},
);

internalApp.listen(XRAY_INTERNAL_API_PORT, '127.0.0.1');
const internalServer = internalApp.listen(XRAY_INTERNAL_API_PORT, '127.0.0.1');

let internalServerClosed = false;

const closeInternalServer = () => {
if (internalServerClosed) return;
internalServerClosed = true;

internalServer.close(() => {
logger.info('Shutting down...');
});
};

app.enableShutdownHooks();

process.on('SIGINT', closeInternalServer);
process.on('SIGTERM', closeInternalServer);

logger.info(
'\n' +
Expand Down
10 changes: 8 additions & 2 deletions src/modules/internal/internal.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Global, Module } from '@nestjs/common';
import { Global, Logger, Module, OnApplicationShutdown } from '@nestjs/common';

import { InternalController } from './internal.controller';
import { InternalService } from './internal.service';
Expand All @@ -10,4 +10,10 @@ import { InternalService } from './internal.service';
controllers: [InternalController],
exports: [InternalService],
})
export class InternalModule {}
export class InternalModule implements OnApplicationShutdown {
private readonly logger = new Logger(InternalModule.name);

async onApplicationShutdown(signal?: string): Promise<void> {
this.logger.log(`${signal} received, shutting down...`);
}
}
10 changes: 8 additions & 2 deletions src/modules/remnawave-node.modules.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Module } from '@nestjs/common';
import { Logger, Module, OnApplicationShutdown } from '@nestjs/common';

import { HandlerModule } from './handler/handler.module';
import { VisionModule } from './vision/vision.module';
Expand All @@ -9,4 +9,10 @@ import { StatsModule } from './stats/stats.module';
imports: [StatsModule, XrayModule, HandlerModule, VisionModule],
providers: [],
})
export class RemnawaveNodeModules {}
export class RemnawaveNodeModules implements OnApplicationShutdown {
private readonly logger = new Logger(RemnawaveNodeModules.name);

async onApplicationShutdown(signal?: string): Promise<void> {
this.logger.log(`${signal} received, shutting down...`);
}
}