Deploy with docker
Download 28.47 Kb. Pdf ko'rish
|
deploy with docker
Deploy with docker 1 Deploy with docker docker va docker compose o’rnatamiz: sudo yum update -y sudo yum install docker sudo service docker start sudo usermod -a -G docker ec2-user sudo curl -L "https://github.com/docker/compose/releases/download/2.20.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-co sudo chmod +x /usr/local/bin/docker-compose sudo yum install git git clone ____________ cd maxway sudo yum install -y libxcrypt-compat docker compose up -d NGINX ni sozlaymiz: sudo yum install nginx sudo systemctl start nginx sudo nano /etc/nginx/nginx.conf # 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" ' Deploy with docker 2 '$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 { server_name softdev.uz www.softdev.uz; location / { proxy_pass http://localhost:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/softdev.uz/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/softdev.uz/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } # Settings for a TLS enabled server. # # server { # listen 443 ssl http2; # listen [::]:443 ssl http2; # server_name _; # root /usr/share/nginx/html; # # ssl_certificate "/etc/pki/nginx/server.crt"; # ssl_certificate_key "/etc/pki/nginx/private/server.key"; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 10m; # ssl_ciphers PROFILE=SYSTEM; # ssl_prefer_server_ciphers on; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # error_page 404 /404.html; # location = /404.html { # } # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # } server { if ($host = www.softdev.uz) { return 301 https://$host$request_uri; } # managed by Certbot Deploy with docker 3 if ($host = softdev.uz) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; server_name softdev.uz www.softdev.uz; return 404; # managed by Certbot }} sudo nginx -t sudo systemctl reload nginx HTTPS ni sozlash: sudo yum install certbot python3-certbot-nginx sudo certbot --nginx agar xatolik bersa: sudo yum install python3-pip -y sudo pip3 install certbot sudo pip3 install certbot-nginx sudo certbot --nginx NGINX ni tekshirish sudo systemctl status nginx sudo systemctl enable nginx sudo systemctl restart nginx Yangi subdomain bilan yangi loyiha qo’shsak: git clone _________ nginx ga yana 1ta server blok qo’shamiz Deploy with docker 4 sudo nano /etc/nginx/nginx.conf server { server_name api.softdev.uz www.api.softdev.uz; location / { proxy_pass http://localhost:8001; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } sudo certbot --expand -d softdev.uz,api.softdev.uz Docker orqali django management commandlar quyidagicha yoziladi: docker ps bilan containerimiz id sini topib olamiz, masalan 12345c1 keyin docker exec -it 12345c1 python manage.py createsuperuser agar migrate kera bo’lsa: docker exec -it 12345c1 python manage.py mograte Download 28.47 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling