This commit is contained in:
parent
b310e7c892
commit
8e3539c63a
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "tsc && jest && prettier --check 'src/**'",
|
"test": "tsc && jest && prettier --check 'src/**'",
|
||||||
"develop": "concurrently \"tsc --watch\" \"nodemon lib\""
|
"develop": "concurrently \"tsc --watch\" \"nodemon ./lib/index.js\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"crypto-random-string": "^3.2.0",
|
"crypto-random-string": "^3.2.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"mailparser": "^2.7.7",
|
"mailparser": "^2.7.7",
|
||||||
|
"pm2": "^4.2.3",
|
||||||
"react": "^16.13.0",
|
"react": "^16.13.0",
|
||||||
"react-dom": "^16.13.0",
|
"react-dom": "^16.13.0",
|
||||||
"smtp-server": "^3.6.0",
|
"smtp-server": "^3.6.0",
|
||||||
|
@ -34,5 +35,23 @@
|
||||||
"jest": {
|
"jest": {
|
||||||
"rootDir": "lib",
|
"rootDir": "lib",
|
||||||
"testEnvironment": "node"
|
"testEnvironment": "node"
|
||||||
|
},
|
||||||
|
"apps": [
|
||||||
|
{
|
||||||
|
"name": "kill-the-newsletter",
|
||||||
|
"script": "./lib/index.js"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"deploy": {
|
||||||
|
"production": {
|
||||||
|
"user": "root",
|
||||||
|
"host": "204.48.21.111",
|
||||||
|
"ref": "origin/master",
|
||||||
|
"repo": "git@github.com:leafac/www.kill-the-newsletter.com.git",
|
||||||
|
"path": "/root/www.kill-the-newsletter.com",
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "production"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
38
src/tasks.ts
38
src/tasks.ts
|
@ -4,12 +4,6 @@ switch (process.argv[2]) {
|
||||||
case "provision":
|
case "provision":
|
||||||
child_process.execSync(`ssh-add`);
|
child_process.execSync(`ssh-add`);
|
||||||
|
|
||||||
exec(`ufw allow ssh`);
|
|
||||||
exec(`ufw allow http`);
|
|
||||||
exec(`ufw allow https`);
|
|
||||||
exec(`ufw allow smtp`);
|
|
||||||
exec(`ufw enable`);
|
|
||||||
|
|
||||||
// https://github.com/nodesource/distributions#debinstall
|
// https://github.com/nodesource/distributions#debinstall
|
||||||
// https://certbot.eff.org/docs/install.html
|
// https://certbot.eff.org/docs/install.html
|
||||||
exec(`apt-get update`);
|
exec(`apt-get update`);
|
||||||
|
@ -25,6 +19,10 @@ switch (process.argv[2]) {
|
||||||
child_process.execSync(`ssh-add`);
|
child_process.execSync(`ssh-add`);
|
||||||
|
|
||||||
execInFolder(`git pull origin master`);
|
execInFolder(`git pull origin master`);
|
||||||
|
execInFolder(`npm ci`);
|
||||||
|
// TODO: rsync
|
||||||
|
// TODO: $ pm2 startup OR $ pm2 save
|
||||||
|
// TODO: $ pm2 start env.js --watch --ignore-watch="node_modules"
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error(
|
console.error(
|
||||||
|
@ -43,7 +41,7 @@ function exec(command: string): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function execInFolder(command: string): void {
|
function execInFolder(command: string): void {
|
||||||
exec(`cd www.kill-the-newsletter.com && ${command}`);
|
exec(`cd www.kill-the-newsletter.com && env NODE_ENV=production ${command}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - run: |
|
// - run: |
|
||||||
|
@ -54,29 +52,3 @@ function execInFolder(command: string): void {
|
||||||
// https://github.com/webfactory/ssh-agent
|
// https://github.com/webfactory/ssh-agent
|
||||||
|
|
||||||
// root 'apt-get install -y curl file git'
|
// root 'apt-get install -y curl file git'
|
||||||
|
|
||||||
// desc "Setup production server"
|
|
||||||
// task :setup do
|
|
||||||
// end
|
|
||||||
|
|
||||||
// desc "Deploy"
|
|
||||||
// task :deploy do
|
|
||||||
// sh 'ssh-add'
|
|
||||||
|
|
||||||
// root 'systemctl stop server caddy exim || true'
|
|
||||||
|
|
||||||
// user_with_environment "git pull origin master"
|
|
||||||
|
|
||||||
// user_with_environment "brew bundle || true"
|
|
||||||
// user_with_environment "bundle install"
|
|
||||||
|
|
||||||
// root 'rsync -av --chown root:root ~kill-the-newsletter/www.kill-the-newsletter.com/exim.conf /home/linuxbrew/.linuxbrew/etc/exim.conf'
|
|
||||||
|
|
||||||
// root 'rsync -av --chown root:root ~kill-the-newsletter/www.kill-the-newsletter.com/server.service /etc/systemd/system/server.service'
|
|
||||||
// root 'rsync -av --chown root:root ~kill-the-newsletter/www.kill-the-newsletter.com/caddy.service /etc/systemd/system/caddy.service'
|
|
||||||
// root 'rsync -av --chown root:root ~kill-the-newsletter/www.kill-the-newsletter.com/exim.service /etc/systemd/system/exim.service'
|
|
||||||
|
|
||||||
// root 'systemctl daemon-reload'
|
|
||||||
// root 'systemctl start server caddy exim'
|
|
||||||
// root 'systemctl enable server caddy exim'
|
|
||||||
// end
|
|
||||||
|
|
Loading…
Reference in New Issue