+++ sh/deploy-elk.sh
... | ... | @@ -0,0 +1,15 @@ |
1 | +#!/bin/sh | |
2 | + | |
3 | +source $HOME/.bash_profile | |
4 | +DEST=/home/ec2-user/git/10ynews | |
5 | +cd $DEST/web | |
6 | +git pull | |
7 | +npm install --only=production | |
8 | + | |
9 | +pm2 restart 10ynews | |
10 | + | |
11 | +# curl -X POST -H 'Content-type: application/json' \ | |
12 | +# --data '{"text":"10ynews Deployment Finished!"}' \ | |
13 | +# https://hooks.slack.com/services/xxxxR3xx4/B0xxDNExx11/xxxWeAVFWcFJOoJBxxxx6Bxx | |
14 | + | |
15 | +# end |
+++ sh/elk.conf
... | ... | @@ -0,0 +1,30 @@ |
1 | +server { | |
2 | + listen 80 default_server; | |
3 | + listen [::]:80 default_server; | |
4 | + server_name _; | |
5 | + root /usr/share/nginx/html; | |
6 | + | |
7 | + # Load configuration files for the default server block. | |
8 | + include /etc/nginx/default.d/*.conf; | |
9 | + | |
10 | + location / { | |
11 | + sendfile off; | |
12 | + proxy_pass http://127.0.0.1:3010; | |
13 | + proxy_redirect default; | |
14 | + proxy_http_version 1.1; | |
15 | + proxy_set_header Host $host; | |
16 | + proxy_set_header X-Real-IP $remote_addr; | |
17 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
18 | + proxy_set_header X-Forwarded-Proto $scheme; | |
19 | + proxy_cache_bypass $http_upgrade; | |
20 | + proxy_max_temp_file_size 0; | |
21 | + } | |
22 | + | |
23 | + error_page 404 /404.html; | |
24 | + location = /40x.html { | |
25 | + } | |
26 | + | |
27 | + error_page 500 502 503 504 /50x.html; | |
28 | + location = /50x.html { | |
29 | + } | |
30 | +} |
+++ sh/install-env.sh
... | ... | @@ -0,0 +1,31 @@ |
1 | +#!/bin/bash | |
2 | +REPO=https://github.com/kenu/10ynews | |
3 | + | |
4 | +sudo yum install -y git | |
5 | +curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash - | |
6 | +sleep 2 | |
7 | +sudo yum install -y nodejs | |
8 | +sudo npm i -g npm | |
9 | +sudo npm i -g pm2 | |
10 | +mkdir ~/git | |
11 | +cd ~/git | |
12 | +git clone $REPO | |
13 | +cp ~/git/10ynews/sh/deploy-10ynews.sh ~ | |
14 | +chmod +x ~/deploy-10ynews.sh | |
15 | + | |
16 | +cd 10ynews/web | |
17 | +npm install --only=production | |
18 | +pm2 start bin/10ynews | |
19 | +sleep 2 | |
20 | +pm2 list | |
21 | + | |
22 | +sudo amazon-linux-extras install -y nginx1.12 | |
23 | +sudo systemctl enable nginx | |
24 | + | |
25 | +sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig | |
26 | +sudo sh -c "sed '38,87d' /etc/nginx/nginx.conf.orig > /etc/nginx/nginx.conf" | |
27 | +cd /etc/nginx/conf.d | |
28 | +sudo curl -O https://raw.githubusercontent.com/kenu/okdevtv/main/sh/elk.conf | |
29 | +sleep 2 | |
30 | +sudo systemctl start nginx | |
31 | + |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?