
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
github-nodejs-shell-server-updater
Advanced tools
Automatic deploy from Github to your server, listen to push updates from Github, pull updated code, install, build and start pm2 process.
Данный скрипт предназначен для автоматического развертывания и запуска nodejs приложений на сервере из репозиториев GitHub с последующим автоматическим обновлением кода на сервере при push на GitHub и автоматическим перезапуском приложения на сервере.
###То есть, как это выглядит:
За пример возьмем домен deployer.site.com (или site.com/deployer)
yarn init
main
как index.js
yarn add github-nodejs-shell-server-updater
index.js
const Deployer = require('github-nodejs-shell-server-updater');
const config = [
{
git_hub_repo_name: 'repo-name',
git_hub_repo_url: 'https://github.com/User/repo-name',
git_hub_secret: 'your-secret-string-for-github-updates',
git_hub_branch_to_deploy: 'main',
site_path_to_dir_where_cloned_code: '/../site.com', //относительно этого файла (директория в которой будет или есть клонированная директория репозитория)
site_port_to_deploy: '3000', //just Node variable PORT=3000
node_packet_manager: 'yarn',
node_build_command: 'build',
node_start_command: 'start',
node_environment: 'production', //just Node variable NODE_ENV=production
},
];
new Deployer(config, 6768);
затем запускаем скрипт node ./index.js
при первом запуске:
deployer.site.com
, если у Вас nginx
, то она будет выглядеть примерно так:location / {
proxy_set_header Connection '';
proxy_read_timeout 180s;
proxy_set_header Host $host;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:6768;
}
теперь нужно настроить GitHub
deployer.site.com
и Secret
из конфига git_hub_secretТеперь, когда Вы запушите обновление, например, с локального компа, в этот репозиторий, GitHub отправит уведомление на deployer.site.com, а скрипт обновит код и перезапустит приложение на сервере.
FAQs
Automatic deploy from Github to your server, listen to push updates from Github, pull updated code, install, build and start pm2 process.
The npm package github-nodejs-shell-server-updater receives a total of 2 weekly downloads. As such, github-nodejs-shell-server-updater popularity was classified as not popular.
We found that github-nodejs-shell-server-updater demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.