pastorsj / blog-api

A simple api for storing users and blogs
https://pastorsj.github.io/blog-api/
MIT License
3 stars 2 forks source link
api blog express mongodb redis supertest

blog-api Build Status Coverage Status Greenkeeper badge

A simple api for storing users and blogs. This is specifically used for my personal blog, which may or may not be up at this point. If it is, please feel free to read through it. Thanks!

Link to my blog

API documentation

Link to Documentation

Setup

See API_SETUP.md

Lets Encrypt with Docker

Creating a certificate

docker run --rm -p 443:443 -p 80:80 --name letsencrypt -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" certbot/certbot certonly -n -m "sampastoriza@yahoo.com" -d blog.sampastoriza.com --standalone --agree-tos

Renewing the certificate

docker run --rm --name letsencrypt -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" -v "/usr/share/nginx/html:/usr/share/nginx/html" certbot/certbot:latest renew --quiet

Running the docker compose file

docker-compose -f docker-compose.yml up --build --force-recreate

Running in the background

docker-compose -f docker-compose.prod.yml up --build --force-recreate -d

Restarting all containers

docker restart $(docker ps -q)

Stopping all containers

docker stop $(docker ps -q)

Renewing the cert manually

I have had problems trying to create a cron job, so I run this manually to regenerate the certificate. Docker will then use the folder that has the generated certificates as volumes when creating the nginx docker container.

sudo certbot certonly -d blog.sampastoriza.com