Skip to content

Instantly share code, notes, and snippets.

@1vank1n
Created July 7, 2022 11:19
Show Gist options
  • Select an option

  • Save 1vank1n/12c26c9e9ca73b1a820133166c8f6d74 to your computer and use it in GitHub Desktop.

Select an option

Save 1vank1n/12c26c9e9ca73b1a820133166c8f6d74 to your computer and use it in GitHub Desktop.

Revisions

  1. 1vank1n created this gist Jul 7, 2022.
    8 changes: 8 additions & 0 deletions deploy.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    cd /web/project/
    source /web/project/.env/bin/activate
    git pull
    pip install -r requirements/staging.txt
    python ./manage.py migrate
    python ./manage.py collectstatic --noinput
    # python ./manage.py test
    touch /tmp/project.conf
    31 changes: 31 additions & 0 deletions nginx-project.ru
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    server {
    listen 80;
    server_name project.ru;

    rewrite_log on;
    error_log /web/log/nginx/project.ru-error.log warn;
    access_log /web/log/nginx/project.ru-access.log;

    location /static/ {
    alias /web/project/static_nginx/;
    expires 1y;
    }

    location /media/ {
    root /web/project;
    expires 1y;
    }

    location /robots.txt {
    root /web/project;
    }

    location /.well-known {
    root /web/project;
    }

    location / {
    include uwsgi_params;
    uwsgi_pass unix:/web/run/project.sock;
    }
    }
    10 changes: 10 additions & 0 deletions supervisor-project.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    [program:project]
    command=/web/project/.env/bin/uwsgi /web/project/uwsgi.ini
    stdout_logfile=/web/log/uwsgi/project.log
    stderr_logfile=/web/log/uwsgi/project_err.log
    autostart=true
    autorestart=true
    redirect_stderr=true
    stopwaitsecs=60
    stopsignal=INT
    user=web
    14 changes: 14 additions & 0 deletions uwsgi.ini
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    [uwsgi]
    home=/web/project/.env
    chdir=/web/project
    module=settings.wsgi:application
    master=True
    disable-logging=True
    pidfile=/web/pid/project.pid
    socket=/web/run/project.sock
    vacuum=True
    max-requests=5000
    uid=web
    gid=web
    chmod-socket=666
    touch-reload=/tmp/project.conf