Skip to content

Commit

Permalink
Update cape2 sh (kevoreilly#2476)
Browse files Browse the repository at this point in the history
  • Loading branch information
doomedraven authored Feb 1, 2025
1 parent 2eb248e commit 17a1fde
Show file tree
Hide file tree
Showing 9 changed files with 923 additions and 668 deletions.
38 changes: 19 additions & 19 deletions docs/book/src/usage/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ To extend the capabilities of control what users can do check `Django migrations

.. _`Django migrations a primer`: https://realpython.com/django-migrations-a-primer/

In few works you need to add new fields to ``models.py`` and run ``poetry run python3 manage.py makemigrations``
In few words you need to add new fields to ``models.py`` and run ``poetry run python3 manage.py makemigrations``


Exposed to internet
Expand All @@ -99,7 +99,7 @@ Exposed to internet
To get rid of many bots/scrappers so we suggest deploying this amazing project `Nginx Ultimate bad bot blocker`_, follow the README for installation steps

* Enable web auth with captcha in `conf/web.conf` properly to avoid any brute force.
* Enable `ReCaptcha`_. You will need to set ``Public`` and ``Secret`` keys in ``web/web/settings.py``
* Enable `ReCaptcha`_. You will need to set ``RECAPTCHA_PUBLIC_KEY`` and ``RECAPTCHA_PRIVATE_KEY`` keys in ``web/web/local_settings.py``
* You might need to "Verify" and set as "Stuff user" to your admin in the Django admin panel and add your domain to Sites in Django admin too
* `AllAuth`_ aka SSO authentication with Google, Github, etc. `Video Tutorial`_ & `StackOverflow Example`_:
* Note ``SITE_ID=1`` in django admin is ``example.com`` rename it to your domain to get it working
Expand Down Expand Up @@ -132,18 +132,19 @@ Run

.. code:: bash
sudo systemctl daemon-reload
sudo service cape-web restart
sudo systemctl daemon-reload
sudo service cape-web restart
NGINX
-----
Next, install NGINX and configure it to be a reverse proxy to Gunicorn.

.. code:: bash
sudo apt install nginx
sudo apt install nginx
Create a configuration file at ``/etc/nginx/conf.d/cape``
Create a configuration file at ``/etc/nginx/conf.d/cape``.
You might need to add ``include /etc/nginx/conf.d/*.conf;`` to ``http`` section inside of ``/etc/nginx/nginx.conf``.

Replace ``www.capesandbox.com`` with your actual hostname.

Expand All @@ -159,14 +160,14 @@ Replace ``www.capesandbox.com`` with your actual hostname.
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/html;
break;
}
default_type "text/plain";
root /var/www/html;
break;
}
location = /.well-known/acme-challenge/ {
return 404;
}
location = /.well-known/acme-challenge/ {
return 404;
}
location / {
proxy_pass http://127.0.0.1:8000;
Expand Down Expand Up @@ -210,8 +211,8 @@ Now enable the nginx configuration by executing the following:

.. code:: bash
rm -f /etc/nginx/conf.d/default
ln -s /etc/nginx/conf.d/cape /etc/nginx/conf.d/default
rm -f /etc/nginx/conf.d/default
ln -s /etc/nginx/conf.d/cape /etc/nginx/conf.d/default
If you want to block users from changing their own email addresses, add the following `location` directive inside of the `server` directive:
Expand Down Expand Up @@ -287,15 +288,14 @@ Let's Encrypt certificates

If you would like to install a free Let's Encrypt certificate on your NGINX
server, follow these steps, replacing ``capesandbox.com`` with your actual
hostname.
hostname. Use ``cape2.sh`` to install dependencies. But also ensure that instruction
are up to date with this https://certbot.eff.org/

Install `certbot`.

.. code-block:: bash
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo cape2.sh letsencrypt
Request the certificate

Expand Down
Loading

0 comments on commit 17a1fde

Please sign in to comment.