Skip to content

Commit

Permalink
Add pip instructions (#698)
Browse files Browse the repository at this point in the history
* Add pip instructions (barring DNS instructions fixes)

* fix typo

* use new id since pip is already in use

* Fix non-DNS instructions

* streamline instructions and start on DNS instructions

* add symlink so DNS instructions work

* Clean up instructions even more, including using terms from context

* Use python instead of python3

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update _scripts/instruction-widget/templates/install/pip.html

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update _scripts/instruction-widget/templates/install/pip.html

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update _scripts/instruction-widget/templates/install/pip.html

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Remove third-party plugin instructions

* move upgrade instructions to after confirming certbot worked

* Remove other mentions of dev/devel

* encourage people to uninstall and certbot os packages

* more strongly suggest people keep cb up to date

* improve readability of system dep installation instructions

* tt is deprecated. I'm not fixing the whole site right now but new code shouldn't use it, at least.

* remove unnecessary redhat-rpm-config

* remove automatic updates line

* put RHEL notes in full sentences

* add dns plugin and sudo to installation instructions

* streamline and rename dropdowns and uris

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
  • Loading branch information
ohemorange and bmw committed Mar 3, 2021
1 parent 93c2aea commit 08afdce
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 6 deletions.
18 changes: 15 additions & 3 deletions _data/inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
"distro": "snap",
"version": "0"
},
{
"name": "pip",
"id": "pip",
"distro": "pip",
"version": "0"
},
{
"name": "Debian 9 (stretch)",
"id": "debianstretch",
Expand Down Expand Up @@ -159,9 +165,15 @@
"version": "15.0"
},
{
"name": "Other Linux",
"id": "pip",
"distro": "linux",
"name": "Other Linux (snapd)",
"id": "othersnap",
"distro": "snap",
"version": "0"
},
{
"name": "Other Linux (pip)",
"id": "otherpip",
"distro": "pip",
"version": "0"
},
{
Expand Down
23 changes: 22 additions & 1 deletion _scripts/instruction-widget/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ module.exports = function(context) {
macos_install();
} else if (context.distro == "devuan" && context.version > 1) {
debian_install();
} else if (context.distro == "pip") {
pip_install();
} else {
snap_install();
}

partials.auto = require(TEMPLATE_PATH + "commonauto.html");
partials.header = require(TEMPLATE_PATH + "header.html");
partials.installcertbot = require(TEMPLATE_PATH + "installcertbot.html");
partials.preparecertbotsnapcommand = require(TEMPLATE_PATH + "preparecertbotsnapcommand.html");
partials.preparecertbotsymlinkcommand = require(TEMPLATE_PATH + "preparecertbotsymlinkcommand.html");
partials.dnsplugins = require(TEMPLATE_PATH + "dnsplugins.html");
partials.dnspluginssetup = require(TEMPLATE_PATH + "dnspluginssetup.html");

Expand Down Expand Up @@ -259,6 +261,25 @@ module.exports = function(context) {
context.package = "--classic certbot";
context.dns_plugins = true;
context.dns_package_prefix = "certbot-dns";
context.original_certbot_location = "/snap/bin";
}

pip_install = function () {
template = "pip";
context.base_command = "certbot";
context.cron_included = false;
context.install_command = "sudo /opt/certbot/bin/pip install";
context.package = "certbot";
if (context.webserver == "apache") {
context.package += " certbot-apache";
} else if (context.webserver == "nginx") {
context.package += " certbot-nginx";
}
context.dns_plugins = true;
context.dns_package_prefix = "certbot-dns";
context.python_name = "/opt/certbot/bin/python";
context.original_certbot_location = "/opt/certbot/bin";
context.upgrade_instructions = true;
}

// This function is currently unused, but we keep it around to make it easy
Expand Down
15 changes: 15 additions & 0 deletions _scripts/instruction-widget/templates/getting-started/renewal.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,18 @@
look for the lock icon in the URL bar.
</p>
</li>

{{#upgrade_instructions}}
<li>
[Monthly] Upgrade certbot
<p>It's important to occasionally update Certbot to keep it up-to-date. To do this, run the
following command on the command line on the machine.
<pre class="no-before"><ol>
<li>{{install_command}} --upgrade {{package}}{{#advanced}} certbot-dns-&lt;PLUGIN&gt;{{/advanced}}</li></ol></pre>
</p>

{{#advanced}}<p>As above, replace <code>&lt;PLUGIN&gt;</code> with the name of your DNS provider.</p>{{/advanced}}

<p>If this step leads to errors, run <code>sudo rm -rf /opt/certbot</code> and repeat all installation instructions.</p>
</li>
{{/upgrade_instructions}}
84 changes: 84 additions & 0 deletions _scripts/instruction-widget/templates/install/pip.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<aside class="note">
<div class="note-header">
<h3>Partial support</h3>
</div>
<p>
The Certbot team supports this installation method on a best effort basis. If you are on
a more obscure or heavily customized system, these instructions may not work and the
Certbot team may be unable to help you resolve the problem.
</p>
</aside>

{{> header}}
<li>
Install system dependencies

<p>System dependencies may include Python 3.6+, including venv (this might be called <code>python3</code>,
<code>python3</code>, or <code>python3-venv</code>) and Augeas for the Apache
plugin (<code>libaugeas0</code> or <code>augeaslibs</code>).</p>

<p>If you're having trouble installing cryptography, you may need to install additional
dependencies. See
<a href="https://cryptography.io/en/latest/installation.html#building-cryptography-on-linux">
the cryptography project's site</a> for more infoformation.</p>

<p>Commands to install system dependencies may look like the following, run on the command
line on the machine.</p>
<p>For APT-based distributions (e.g. Debian, Ubuntu ...):
<pre class="no-before"><ol>
<li>sudo apt update</li>
<li>sudo apt install python3 python3-venv libaugeas0</li>
</ol></pre>
</p>
<p>For RPM-based distributions (e.g. Fedora, CentOS ...):
<pre class="no-before"><ol>
<li>sudo dnf install python3 augeas-libs</li></ol></pre></p>
<p>
* Note that old distributions use <code>yum</code> instead of <code>dnf</code>, and that
RHEL-based distributions use <code>python3X</code> instead of <code>python3</code>
(e.g. <code>python36</code>).
</p>

<p>These packages may have slightly different names on other distributions; a search such as
"augeas on &lt;your_system_name&gt;" will probably yield helpful results.</p>
</li>
<li>
Remove certbot-auto and any Certbot OS packages
<p>
If you have any Certbot packages installed using an OS package manager like
<code>apt</code>, <code>dnf</code>, or <code>yum</code>, you should remove them before
installing the Certbot snap to ensure that when you run the command
<code>certbot</code> the snap is used rather than the installation from your OS
package manager. The exact command to do this depends on your OS, but
common examples are <code>sudo apt-get remove certbot</code>, <code>sudo dnf
remove certbot</code>, or <code>sudo yum remove certbot</code>.
</p>
<p>
If you previously used Certbot through the certbot-auto script, you should
also remove its installation by following the instructions <a
href="/docs/uninstall.html">here</a>.
</p>
</li>
<li>
Set up a Python virtual environment
<p>
Execute the following instructions on the command line on the machine to set up a virtual
environment.
<pre class="no-before"><ol>
<li>sudo python3 -m venv /opt/certbot/</li>
<li>{{install_command}} --upgrade pip</li>
</ol></pre>
</p>
</li>

{{> installcertbot}}
{{>preparecertbotsymlinkcommand}}


{{#advanced}}
{{#dns_plugins}}
{{/dns_plugins}}
{{/advanced}}

{{> dnspluginssetup}}

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
Execute the following instruction on the command line on the machine to ensure
that the <tt>certbot</tt> command can be run.
</p>
<pre>sudo ln -s /snap/bin/certbot /usr/bin/certbot</pre>
<pre>sudo ln -s {{original_certbot_location}}/certbot /usr/bin/certbot</pre>
</li>
2 changes: 1 addition & 1 deletion _scripts/instruction-widget/templates/install/snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h3>Snap Support</h3>
</li>

{{>installcertbot}}
{{>preparecertbotsnapcommand}}
{{>preparecertbotsymlinkcommand}}

{{#advanced}}
{{#dns_plugins}}
Expand Down

0 comments on commit 08afdce

Please sign in to comment.