-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Homework: CI/CD | ||
|
||
## Task | ||
|
||
## Solution | ||
|
||
Setup AWS EC2 instance with Nginx and Docker installed. | ||
|
||
```bash | ||
sudo -i | ||
apt update | ||
apt install nginx | ||
systemctl start nginx | ||
systemctl status nginx | ||
systemctl enable nginx | ||
|
||
cd /etc/nginx | ||
|
||
|
||
sudo apt install apt-transport-https ca-certificates curl software-properties-common | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | ||
sudo apt update | ||
sudo apt install docker-ce | ||
systemctl status docker | ||
systemctl enable docker | ||
``` | ||
|
||
```bash | ||
sudo nano /etc/nginx/sites-available/webapi.conf | ||
sudo ln -s /etc/nginx/sites-available/webapi.conf /etc/nginx/sites-enabled/ | ||
|
||
# Test Nginx configuration | ||
sudo nginx -t | ||
``` | ||
|
||
``` | ||
server { | ||
listen 80; | ||
location /api { | ||
proxy_pass http://localhost:8080; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Host $server_name; | ||
} | ||
} | ||
``` | ||
|
||
```bash | ||
docker pull mongo; docker run -d -p 27017:27017 --name mongodb mongo | ||
|
||
docker pull vladyslavyefremov/hw25-webapi:0.1.0-hw25-ci-cd-run6.1 | ||
docker run -d -p 8080:8080 vladyslavyefremov/hw25-webapi:0.1.0-hw25-ci-cd-run6.1 --name hw25-webapi | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Get version | ||
GET http://localhost:5000/api/v1/version | ||
|
||
### Get version Docker | ||
GET http://localhost:8080/api/v1/version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters