Giter Site home page Giter Site logo

omair-inam / commento-docker-ssl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rrhernandez/commento-docker-ssl

0.0 0.0 0.0 3 KB

This repository has easy install instructions for installing the Self-hosting Commento server on your own server

Dockerfile 100.00%

commento-docker-ssl's Introduction

Commento easy-install with Docker Compose and SSL

This repository has easy install instructions for installing the Self-hosting Commento server on your own server

Prerequisites

First steps

Ensure your system is up to date:

sudo apt update && sudo apt upgrade

Your Commento site will serve its content over HTTPS, so you will need to obtain an SSL/TLS certificate. Use Certbot to request and download a free certificate from Let’s Encrypt:

sudo apt install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install certbot
sudo certbot certonly --standalone -d commento.mydomain.com

These commands will download a certificate to /etc/letsencrypt/live/commento.mydomain.com/ on your server.

Install Commento

Clone repository:

git clone https://github.com/rrhernandez/commento-docker-ssl.git
cd commento-docker-ssl

Edit docker-compose.yml, replace commento.mydomain.com with your domain and insert a new database password where your_database_root_password appears, the values for database__connection__password and MYSQL_ROOT_PASSWORD should be the same. The Docker Compose file create a bind mount so create a directory for that bind mount:

sudo mkdir -p /usr/share/nginx/html

Edit default.conf file (inside nginx directory), replace all instances of mydomain.com with your domain.

This configuration will redirect all requests on HTTP to HTTPS (except for Let’s Encrypt challenge requests), and all requests on HTTPS will be proxied to the commento service.

Run and Test Your Site

From the commento-docker-ssl directory start the Commento server by running all services defined in the docker-compose.yml file:

docker-compose up

Check carefully all the messages, if there are no errors then you can CTRL-C and run again with the daemon option this time:

docker-compose up -d

Complete the setup

To complete the setup process, navigate to https://commento.mydomain.com and follow Commento docs

Then embed the following piece of HTML in your website wherever you want Commento to load. You may want to do this at the bottom of each post.

<div id="commento"></div>
<script defer
  src="http://commento.mydomain.com/js/commento.js">
</script>

And we're done.

Usage and Maintenance

Because the option restart: always was assigned to your services in your docker-compose.yml file, you do not need to manually start your containers if you reboot your Linode. This option tells Docker Compose to automatically start your services when the server boots.

Update Commento

Your docker-compose.yml specifies the latest version of the Commento image, so it’s easy to update your Commento version:

docker-compose down
docker-compose pull && docker-compose up -d

Renew your Let’s Encrypt Certificate

Open your Crontab in your editor:

sudo crontab -e

Add a line which will automatically invoke Certbot at 11PM every day. Replace commento.mydomain.com with your domain:

0 23 * * *   certbot renew -d commento.mydomain.com --deploy-hook='docker exec ghost_nginx_1 nginx -s reload'

Certbot will only renew your certificate if its expiration date is within 30 days. Running this every night ensures that if something goes wrong at first, the script will have a number of chances to try again before the expiration.

You can test your new job with the --dry-run option:

sudo bash -c "certbot certonly -n --webroot -w /usr/share/nginx/html -d commento.mydomain.com --deploy-hook='docker exec ghost_nginx_1 nginx -s reload'"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.