- Notifications
You must be signed in to change notification settings - Fork0
This is a complete stack for running a projects with Node, MongoDB, NGINX and PHP into Docker containers using docker-compose tool and with Certbot for the HTTPS certificate.
License
Inushin/dockerNodeSSL
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
If you find this useful, remember about giving a start ⭐ to this repo or share it 🔁
Created fromhttps://github.com/Inushin/dockerSymfonySSL
This is a complete stack for running projects with Node, MongoDB, NGINX and PHP into Docker containers using docker-compose tool and with Certbot for the HTTPS certificate.
It is composed by 5 containers:
nginx
, acting as the webserver.php
, the PHP-FPM container with the 7.4 PHPversion.mongodb
which is the MongoDB database container with aMongoDB 4.4 image.node
the Node container with the 13 Node version.certbot
generates the SSL certificate for your personal domain.
You needDocker andDocker-compose where you are going to launch this so, if you do not have it... clickHERE or go to the end of this
.md
^^Clone this rep.
Check that the dir.
data/certbot/www/.well-known
exist. If it is not, create it 😀.Edit
init
with your domain and an email.Edit the
docker-compose.yml
with your DB information.Edit
data/nginx/node/index.js
with your domain.Run
./init
.Edit
data/nginx/web.conf
with your domain and your project dir.Run
docker-compose down
Run
docker-compose up -d
The 4 containers are deployed:
Creating docker_mongo_1 ... doneCreating docker_php_1 ... doneCreating docker_nginx_1 ... doneCreating docker_node_1 ... doneCreating docker-certbot-1 ... done
Run Docker-compose:
docker-compose up -d
/docker-compose up
Check Docker-compose's volumens status:
docker-compose ps -a
/docker-compose ps
Check Docker's images:
docker images -a
Remove Docker's images:
docker rmi -f imageID1 imageID2 ...
(-f = force)Enter to a Docker's volumen:
docker-compose exec VolumenID sh
/docker-compose exec VolumenID bash
Copy a file to the docker we want to:
docker cp file docker_id:/dir
See all the configuration of the docker-compose.yml with the paths completed:
docker-compose config
See all the information of a volumen (interesting of IPs):
docker inspect VOLUMEN_ID
Remove all dangling (not tagged or associated with a container) containers, volumes, networks and images:
docker system prune
Remove all unused containers and images with at least one container associated to them:
docker system prune -a
Shows all unused local images:
docker images ls -f dangling=true
Shows all unused local volumes:
docker volume ls -f dangling=true
Remove all local volumes not used by at least one container:
docker volume prune
Adjust the installation to your OS. Here you have the one for EC2(AWS) with CentOS
- Docker installation
Download and install Docker:
yum install docker
Gives permisions so you can run it everywhere:
usermod -a -G docker ec2-user
Starts Docker's service:
service docker start
Starts Docker's service each time you run the SO:
chkconfig docker on
- Docker-compose installation
Download and install Docker-compose:
curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Make it executable from anywhere:
chmod +x /usr/local/bin/docker-compose
Makes an direct access for docker-compose:
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Check the version and the installation:
docker-compose --version
If you find any bug or just want to give your feedback (remember the ⭐ ^^),Feel free to do it. I am, as you, constantly learning and things change so quickly that... no one knows ^^
- 0.0.0 - Creation of the rep with the config finished - 26/01/2022
- 0.0.1 - Updated useful Docker commands - 10/02/2022