From a6879f3849640c076a950b297cd963416ef806a9 Mon Sep 17 00:00:00 2001 From: leandrofars Date: Sat, 24 Feb 2024 09:35:48 -0300 Subject: [PATCH] refact(devops): change folders path + clean unused code and files --- README.md | 4 +- .../compose}/docker-compose.yaml | 0 devops/frontend/ecosystem.config.js | 10 -- devops/local_run/run.sh | 21 --- devops/local_run/run1.sh | 6 - devops/local_run/run2.sh | 6 - devops/local_run/run3.sh | 6 - devops/local_run/run4.sh | 6 - devops/nginx/nginx.conf | 149 ------------------ devops/services/controller.service | 11 -- devops/services/mochi.service | 11 -- devops/services/socketio.service | 11 -- 12 files changed, 2 insertions(+), 239 deletions(-) rename {devops => deploy/compose}/docker-compose.yaml (100%) delete mode 100644 devops/frontend/ecosystem.config.js delete mode 100644 devops/local_run/run.sh delete mode 100644 devops/local_run/run1.sh delete mode 100644 devops/local_run/run2.sh delete mode 100644 devops/local_run/run3.sh delete mode 100644 devops/local_run/run4.sh delete mode 100644 devops/nginx/nginx.conf delete mode 100644 devops/services/controller.service delete mode 100644 devops/services/mochi.service delete mode 100644 devops/services/socketio.service diff --git a/README.md b/README.md index 473b31a..414babc 100644 --- a/README.md +++ b/README.md @@ -194,8 +194,8 @@ Currently, telecommunications giants and startups, publishing new software daily

Developer:

Run app using Docker:
-user@user-laptop:~$ cd oktopus/devops
-user@user-laptop:~/oktopus/devops$ docker compose up
+user@user-laptop:~$ cd oktopus/deploy/compose
+user@user-laptop:~/oktopus/deploy/compose$ docker compose up
 
  • diff --git a/devops/docker-compose.yaml b/deploy/compose/docker-compose.yaml similarity index 100% rename from devops/docker-compose.yaml rename to deploy/compose/docker-compose.yaml diff --git a/devops/frontend/ecosystem.config.js b/devops/frontend/ecosystem.config.js deleted file mode 100644 index c3b1463..0000000 --- a/devops/frontend/ecosystem.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - apps: [ - { - name: 'oktopus', - env: { - NEXT_PUBLIC_REST_ENPOINT: 'https://oktopus.ifsc.digital:8000' - }, - }, - ], -}; \ No newline at end of file diff --git a/devops/local_run/run.sh b/devops/local_run/run.sh deleted file mode 100644 index b1d3d86..0000000 --- a/devops/local_run/run.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -wcorr=68 # manual fix for vertical panels -hcorr=26 # manual fix for horizontal panels - - -tmps=$(LANG=C xrandr|grep -om1 'current.*,') -tmps=${tmps/,} -tmps=${tmps/current } -echo "screen resolution = $tmps pixels" -wscr=${tmps/ x*} -hscr=${tmps/*x } -wter=$(( (wscr-wcorr)/2 )) -hter=$(( (hscr-hcorr)/2 )) -echo "terminal width = $wter pixels" -echo "terminal height = $hter pixels" - -terminator --geometry="${wter}x${hter}+0-0" -x bash run1.sh & -terminator --geometry="${wter}x${hter}+0-0" -x bash run2.sh & -terminator --geometry="${wter}x${hter}+0-0" -x bash run3.sh & -terminator --geometry="${wter}x${hter}+0-0" -x bash run4.sh & \ No newline at end of file diff --git a/devops/local_run/run1.sh b/devops/local_run/run1.sh deleted file mode 100644 index 04ad2a9..0000000 --- a/devops/local_run/run1.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -cd $HOME/dev/oktopus/backend/services/mochi -go run cmd/main.go -echo "" -bash \ No newline at end of file diff --git a/devops/local_run/run2.sh b/devops/local_run/run2.sh deleted file mode 100644 index efffe16..0000000 --- a/devops/local_run/run2.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -cd $HOME/dev/oktopus/backend/services/controller -go run cmd/oktopus/main.go -u root -P root -mongo mongodb://172.16.238.3:27017 -echo "" -bash \ No newline at end of file diff --git a/devops/local_run/run3.sh b/devops/local_run/run3.sh deleted file mode 100644 index f16e9cb..0000000 --- a/devops/local_run/run3.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -cd $HOME/dev/oktopus/frontend/ -npm run dev -echo "" -bash \ No newline at end of file diff --git a/devops/local_run/run4.sh b/devops/local_run/run4.sh deleted file mode 100644 index be3a283..0000000 --- a/devops/local_run/run4.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -cd $HOME/dev/oktopus/backend/services/socketio -npm start -echo "" -bash \ No newline at end of file diff --git a/devops/nginx/nginx.conf b/devops/nginx/nginx.conf deleted file mode 100644 index c548171..0000000 --- a/devops/nginx/nginx.conf +++ /dev/null @@ -1,149 +0,0 @@ -# For more information on configuration, see: -# * Official English Documentation: http://nginx.org/en/docs/ -# * Official Russian Documentation: http://nginx.org/ru/docs/ - -user nginx; -worker_processes auto; -error_log /var/log/nginx/error.log notice; -pid /run/nginx.pid; - -# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. -include /usr/share/nginx/modules/*.conf; - -events { - worker_connections 1024; -} - -http { - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - tcp_nopush on; - keepalive_timeout 65; - types_hash_max_size 4096; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - # Load modular configuration files from the /etc/nginx/conf.d directory. - # See http://nginx.org/en/docs/ngx_core_module.html#include - # for more information. - include /etc/nginx/conf.d/*.conf; - - server { - if ($host = oktopus.app.br) { - return 301 https://$host$request_uri; - } - listen 80; - listen [::]:80; - server_name oktopus.app.br; - return 404; - } - - server { - listen 443 ssl http2; - listen [::]:443 ssl http2; - server_name oktopus.app.br; - root /usr/share/nginx/html; - - # Load configuration files for the default server block. - include /etc/nginx/default.d/*.conf; - - ssl_certificate "/etc/letsencrypt/live/oktopus.app.br/fullchain.pem"; - ssl_certificate_key "/etc/letsencrypt/live/oktopus.app.br/privkey.pem"; - ssl_session_cache shared:SSL:1m; - ssl_session_timeout 10m; - ssl_ciphers HIGH:!aNULL:!MD5; - ssl_prefer_server_ciphers on; - - error_page 404 /404.html; - location = /404.html { - } - - location / { - proxy_pass http://127.0.0.1:3001; - proxy_read_timeout 60; - proxy_connect_timeout 60; - proxy_redirect off; - } - } - - server { - if ($host = oktopustr369.com) { - return 301 https://$host$request_uri; - } - listen 80; - listen [::]:80; - server_name oktopustr369.com; - return 404; - } - - server { - listen 443 ssl http2; - listen [::]:443 ssl http2; - server_name oktopustr369.com; - root /usr/share/nginx/html; - - # Load configuration files for the default server block. - include /etc/nginx/default.d/*.conf; - - ssl_certificate "/etc/letsencrypt/live/oktopustr369.com/fullchain.pem"; - ssl_certificate_key "/etc/letsencrypt/live/oktopustr369.com/privkey.pem"; - ssl_session_cache shared:SSL:1m; - ssl_session_timeout 10m; - ssl_ciphers PROFILE=SYSTEM; - ssl_prefer_server_ciphers on; - - error_page 404 /404.html; - location = /404.html { - } - - location / { - proxy_pass http://127.0.0.1:3000; - proxy_read_timeout 60; - proxy_connect_timeout 60; - proxy_redirect off; - - # Allow the use of websockets - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - } - location /api { - proxy_pass http://127.0.0.1:8001; - proxy_read_timeout 60; - proxy_connect_timeout 60; - proxy_redirect off; - - # Allow the use of websockets - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - } - location /socket.io { - proxy_pass http://127.0.0.1:5000; - proxy_read_timeout 60; - proxy_connect_timeout 60; - proxy_redirect off; - - # Allow the use of websockets - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - } - } -} \ No newline at end of file diff --git a/devops/services/controller.service b/devops/services/controller.service deleted file mode 100644 index dff8900..0000000 --- a/devops/services/controller.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=TR-369 Controller - -[Service] -ExecStart=/usr/bin/controller -u 'root' -P '' -mongo '' -ap 8001 - -Restart=always -RestartSec=4 - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/devops/services/mochi.service b/devops/services/mochi.service deleted file mode 100644 index 13a9f0c..0000000 --- a/devops/services/mochi.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Mochi broker - -[Service] -ExecStart=/usr/bin/mochi -path /home/ec2-user/oktopus/backend/services/mochi/cmd/auth.prod.json -full_chain_path /etc/letsencrypt/live/oktopus.ifsc.digital/fullchain.pem -private_key_path /etc/letsencrypt/live/oktopus.ifsc.digital/privkey.pem -redis "" - -Restart=always -RestartSec=4 - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/devops/services/socketio.service b/devops/services/socketio.service deleted file mode 100644 index 462702e..0000000 --- a/devops/services/socketio.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Socketio Server - -[Service] -ExecStart=/home/ec2-user/.nvm/versions/node/v20.1.0/bin/node /home/ec2-user/oktopus/backend/services/socketio/server.js - -Restart=always -RestartSec=4 - -[Install] -WantedBy=multi-user.target \ No newline at end of file