๐DevOps
[Github Action] Github Action์ ์ด์ฉํด์ EC2์ ์๋๋ฐฐํฌํ๊ธฐ (์์ฑ์ค)
์๋ ๋ฐฐํฌ ๋ก์ง์, ๊ฐ๋ฐ ๋ณ๊ฒฝ ์ฌํญ์ด main ๋ธ๋ ์น์ merge ๋๋ฉด ec2์ ์ ์ํด์ ํด๋น ํ๋ก์ ํธ์ ๋ธ๋ ์น๋ฅผ pull ํ๋ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๊ณ ์์๋ค. ๊ทธ๋ฐ๋ฐ Github Action์ ์ฌ์ฉํด์ ์ ๊ณผ์ ์ ์๋ํ์ํฌ ์ ์๋ค๋ ๊ฒ์ ์๊ฒ๋์ด ์ ์ฉํด๋ณด์๋ค. ํ์ดํ๋ผ์ธ 1. ๋ก์ปฌ์ปดํจํฐ์์ main ๋ธ๋ ์น๋ก push ํ๋ฉด 2. Github Action ์คํ 1) ec2์ ์ ์ 2) ์์ฑ๋ script ์คํ - cloneํ ํ๋ก์ ํธ๋ก ์ด๋ - ์ง์ ํ ๋ธ๋ ์น๋ฅผ git pull 3. ๋ฐฐํฌ ์๋ฃ ๋ฐฉ๋ฒ 1. Github Action ์์ฑํ๊ธฐ Github > ์ ์ฉํ ํ๋ก์ ํธ > Action set up a workflow yourself ํด๋ฆญ .yml ํ์ผ ์์ฑํ๊ธฐ name: main branch auto ci pro..
[AWS] Job for nginx.service failed because the control process exited with error code. ์๋ฌ
"Job for nginx.service failed because the control process exited with error code." # nignx ์ํ ํ์ธ systemctl status nginx.service "Failed to start A high performance web server and a reverse proxy server." - ํฌํธ ๋ฒํธ๊ฐ ์ถฉ๋๋ ๊ฒ >>apache๊ฐ ๊น๋ ค์๋ ๊ฒฝ์ฐ # apache ์ฌ์ฉ ๋ฉ์ถค sudo service apache2 stop >> apache๋ฌธ์ ๊ฐ ์๋ ๊ฒฝ์ฐ # 80๋ฒ ํฌํธ ํ์ธํ๊ธฐ netstat -anp | grep 80 => nginx๊ฐ ์ฌ์ฉ์ค # nginx PID ํ์ธํ๊ธฐ ps -aef | grep nginx # PID ์ฃฝ์ด๊ธฐ (๋งจ..
[AWS] ํ๋ ฅ์ IP(Elastic IPs) ์ฌ์ฉํ๊ธฐ
AWS์์ ์ธ์คํด์ค๋ฅผ ์์ฑํ๋ฉด IP์ฃผ์๊ฐ ์ฃผ์ด์ง๋๋ฐ, ์ด IP์ฃผ์๋ ๊ณ ์ ๋ ๊ฒ์ด ์๋๋ผ์ ์ธ์คํด์ค๋ฅผ ์ค์งํ๊ฑฐ๋ ์ข ๋ฃํ๋ค๊ฐ ๋ค์ ์์ํ๋ฉด ๊ธฐ์กด์ ํ ๋น๋ฐ์ IP์ฃผ์๊ฐ ๋ณ๊ฒฝ๋์ด ๋ฒ๋ฆฐ๋ค. ์ ์ํฉ์ ๋ฐฉ์งํ๊ณ ์ถ๋ค๋ฉด ์ธ์คํด์ค์ ํ๋ ฅ์ IP(Elastic IP)๋ฅผ ์ฐ๊ฒฐํด์ฃผ์ด์ผ ํ๋ค. 1. ํ๋ ฅ์ IP ํ ๋น ๋ฐ๊ธฐ 2. ์ธ์คํด์ค์ ํ ๋น๋ฐ์ IP ์ฐ๊ฒฐํ๊ธฐ ์ฐ๊ฒฐํด์ค ์ธ์คํด์ค ์ ํ ์ด๋ ๊ฒ ์ฐ๊ฒฐํด์ฃผ๊ณ ์ธ์คํด์ค ๋์๋ณด๋์ ๋ค์ด๊ฐ ํผ๋ธ๋ฆญ IP ์ฃผ์๋ฅผ ๋ณด๋ฉด ๋ณ๊ฒฝ๋ ๊ฒ์ ํ์ธํ ์ ์๋ค. ์ดํ ๋ด๊ฐ ๊ฒช์๋ ์์๋ฐ์ ์๋ฌ ์ํฉ 1. ํ๋ ฅ์ IP๋ฅผ ์ฐ๊ฒฐํ ํ ํด๋น ์ธ์คํด์ค์ ๋ฐฐํฌํ๋ ์น์ ์ ์์ ์๋ํ๋๊น '์ฌ์ดํธ์ ์ฐ๊ฒฐํ ์ ์์'์ด ๋จ๋ฉฐ ์ ์์ด ์๋จ => ์์ธ : ๋ฐฐํฌํ์๋ ์ฐ๊ฒฐํ ๋๋ฉ์ธ์ ๊ตฌ๋งคํ ์ฌ์ดํธ์ DNS๊ด๋ฆฌ์์๋ ๋ณ๊ฒฝ๋ I..
[AWS] https ์ธ์ฆ ๋ง๋ฃ์ ํด๊ฒฐ๋ฐฉ๋ฒ
"์ฐ๊ฒฐ์ด ๋น๊ณต๊ฐ๋ก ์ค์ ๋์ด ์์ง ์์ต๋๋ค" => https ์ธ์ฆ ๋ง๋ฃ๋์ ์๊ธด ๋ฌธ์ 1, SSL ์ธ์ฆ์ ๋ฐ๊ธ๋ฐ๊ธฐ # lets encrypt ์ค์น sudo apt update -y & sudo apt install lets encrypt -y # nginx ์ค์ง sudo systemctl stop nginx # ์ธ์ฆ์ ๋ฐ๊ธ sudo certbot certonly --standalone -d {๋ฐ๊ธ๋ฐ์ ๋๋ฉ์ธ} - ๋ฐ๊ธ๋ฐ์ผ๋ฉด ์๋์ .pem ํ์ผ 2๊ฐ์ ์์น๋ฅผ ์๋ ค์ค # nginx ์ค์ ํ์ผ ์์ /etc/nginx/sites-available์ default ๋ฅผ ์์ ์์์ ์๋ ค์ค ํ์ผ 2๊ฐ๋ฅผ ๋ถ์ฌ๋ฃ๊ธฐ ssl_certificate “{fullchain.pemd์ ์์น}; ssl_certificate_key ..
[AWS] mysql ์ธ๋ถ์ ๊ทผ ํ์ฉํ๊ธฐ
mysql์์ ์ค์ root ๊ณ์ ์์ฑํ๊ธฐ CREATE USER 'root'@'%' IDENTIFIED BY '{๋น๋ฐ๋ฒํธ}'; ์ธ๋ถ์ ๊ทผ ํ์ฉํ๊ธฐ //๋ชจ๋ ์ ๊ทผ ํ์ฉ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; //ํน์ IP ์ ๊ทผ ํ์ฉ GRANT ALL PRIVILEGES ON *.* TO ‘root’@‘192.168.56.101’ WITH GRANT OPTION; //ํน์ IP ๋์ญ ์ ๊ทผ ํ์ฉ GRANT ALL PRIVILEGES ON *.* TO ‘root’@‘192.168.%’ WITH GRANT OPTION; ๊ณ์ ์ด ์ ๋ฑ๋ก ๋์๋์ง ํ์ธํ๊ธฐ select user,plugin,host from mysql.user; ์ ์ฅํ๊ธฐ FLUSH ..
[AWS] ์ฐ๋ถํฌ์ ๋ผ๋ผ๋ฒจ ๊ฐ๋ฐํ๊ฒฝ ๊ตฌ์ถํ๊ธฐ php7.4
sudo apt-get update apache2 ์ค์น sudo apt-get install apache2 mysql ์ค์น sudo apt-get install mysql-server php7.3 ์ค์น sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.3 sudo apt-get install php7.3-bz2 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-mysql php7.3-mbstring php7.3-zip php7.3-fpm php7.3-intl php7.3-simplexml php7.3-bcmath php7.3-dev php7.3-cg..