-
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.
Merge pull request #3 from thisiscleverson/development
Development
- Loading branch information
Showing
4 changed files
with
55 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
deploy: | ||
sudo mv ~/http-server.service /etc/systemd/system/ \ | ||
&& sudo systemctl enable http-server \ | ||
&& sudo systemctl restart http-server \ | ||
start-docker: | ||
docker compose up -d | ||
|
||
start-service: | ||
sudo systemctl start app | ||
|
||
stop: | ||
docker compose down | ||
|
||
status: | ||
sudo systemctl status app | ||
|
||
build: | ||
docker compose up --build &&\ | ||
docker compose down | ||
|
||
deploy: | ||
sudo cp ./app.service /etc/systemd/system/ && \ | ||
sudo systemctl enable app && \ | ||
sudo systemctl restart app |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[Unit] | ||
Description=My Docker Application | ||
Description=Start docker compose Application | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
Restart=always | ||
ExecStart=/usr/local/bin/docker-compose -f /var/www/blog/docker-compose.yml up | ||
ExecStop=/usr/local/bin/docker-compose -f /var/www/blog/docker-compose.yml down | ||
ExecStart=/usr/local/bin/docker-compose -f /var/www/blog/docker-compose.yml up -d | ||
Restart=on-failure | ||
RestartSec=5 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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 |
---|---|---|
@@ -1,19 +1,39 @@ | ||
events {} | ||
|
||
http { | ||
access_log on; | ||
sendfile on; | ||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log; | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
listen [::]:80; | ||
|
||
server_name $DOMAIN www.$DOMAIN; | ||
|
||
location / { | ||
proxy_pass http://app:5000; | ||
proxy_pass http://$FLASK_SERVER_ADDR; | ||
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-Proto $scheme; | ||
} | ||
} | ||
} | ||
|
||
server { | ||
listen [::]:443 ssl http2; | ||
listen 443 ssl http2; | ||
server_name $DOMAIN www.$DOMAIN; | ||
|
||
ssl_certificate /etc/letsencrypt/live/$DOMAIN/fullchain.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/$DOMAIN/privkey.pem; | ||
|
||
location / { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-Host $host; | ||
proxy_set_header X-Forwarded-Proto https; | ||
proxy_pass http://$FLASK_SERVER_ADDR; | ||
} | ||
|
||
} | ||
} |