Skip to content

Commit

Permalink
Add All Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sinalalebakhsh committed Jul 10, 2024
1 parent f8b0d42 commit e5d471a
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Setup Docker On VPS.txt → Steps /Setup Docker On VPS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-
sudo chmod +x /usr/local/bin/docker-compose


docker pull python:3.10

docker pull postgres:14

docker pull nginx:latest
53 changes: 53 additions & 0 deletions Steps /offline steps to run docker-compose-yml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
##### Option 1: Adjust System Settings

## Open the sysctl.conf file:
sudo nano /etc/sysctl.conf



## Add the following line to allow non-root users to bind to port 443:
net.ipv4.ip_unprivileged_port_start=443


## Save the file and exit the editor.


## Reload the sysctl configuration:
sudo sysctl -p



##### Option 2: Use Ports Above 1024

## Updated docker-compose.yml:

version: '3.9'

services:
web:
build: .
command: sh -c "python manage.py makemigrations && python manage.py migrate && gunicorn myproject.wsgi:application --bind 0.0.0.0:8000"
volumes:
- .:/code
ports:
- "8000:8000"
expose:
- "8000"
env_file:
- .env

nginx:
image: nginx:latest
ports:
- "8080:80"
- "8443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
depends_on:
- web

db:
image: postgres:14
environment:
- "POSTGRES_HOST_AUTH_METHOD=trust"
1 change: 1 addition & 0 deletions Steps /online steps to run docker-compose-yml.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FOR FIRST TIME to Run in fresh VPS



sudo apt install certbot

certbot certonly --standalone --agree-tos --register-unsafely-without-email -d sina.sinalalehbakhsh.monster -v
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ services:
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
- "8080:80"
- "8443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.ymloffline
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3.9'

services:
web:
build: .
command: sh -c "python manage.py makemigrations && python manage.py migrate && gunicorn config.wsgi:application --bind 0.0.0.0:8000"
volumes:
- .:/code
ports:
- "8000:8000"
expose:
- "8000"
env_file:
- .env

nginx:
image: nginx:latest
ports:
- "8080:80"
- "8443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
depends_on:
- web

db:
image: postgres:14
environment:
- "POSTGRES_HOST_AUTH_METHOD=trust"
30 changes: 30 additions & 0 deletions docker-compose.ymlonline
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3.9'

services:
web:
build: .
command: sh -c "python manage.py makemigrations && python manage.py migrate && gunicorn config.wsgi:application --bind 0.0.0.0:8000"
volumes:
- .:/code
ports:
- "8000:8000"
expose:
- "8000"
env_file:
- .env

nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
depends_on:
- web

db:
image: postgres:14
environment:
- "POSTGRES_HOST_AUTH_METHOD=trust"

0 comments on commit e5d471a

Please sign in to comment.