If you find this useful, remember about giving a start ⭐ to this repo or share it 🔁
This is a complete stack for running a builded QWIK App into Docker containers using docker compose tool, with a proxy Nginx between front and back (conected to the DB container with Sequelize ORM).
It is composed by 4 containers:
qwikapp
, the one that runs the builded QWIK APP in a container with Node and Express as server.nodebackend
, a container with node runing and the ORM Sequelize conected to the "postgres" container.middlenginx
that handles the request with a proxy configuration, linking front and back.postgres
storing the PostgreSQL 15 databases.
-
You need Docker and Docker Compose where you are going to launch this so, if you do not have it... click HERE or go to the end of this
.md
^^ -
Clone this rep.
-
Edit the
docker-compose.yml
with your DB information. Notice that the configuration for the Postgres database, has information for another user and DB. In the01-init.sh
file, that is indb
dir, there is a configuration for adding the passwordpostgres
to the postgres user and creating a new DB, calleddocker
with a new user with the same name and password. Change if you need to. Apart from this, modifies theph_hba.conf
addinghost all all 0.0.0.0/0 md5
so there is no problems with the conection of the database and the users. -
Run
docker compose up
to check that everything runs correctly. If there it no errors (apart from the initial one of postgreSQL linked with the initial configuration being settled), all has been done correctly. Stop (ctrl+C
) and run it again. If you usedocker compose up -d
this will run it in the background. -
To check that eveything is running correctly in the background, run
docker compose ps -a
and you will see the running containers.
-
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
-
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 Linux Mint (Ubuntu based)
-
Download and install Docker:
apt install docker
-
Gives permisions so you can run it everywhere:
sudo usermod -aG docker $USER
-
Starts Docker's service:
service docker start
-
Starts Docker's service each time you run the SO:
chkconfig docker on
For this repo, DockerComposeV2 was used, so that is why we use docker compose
instead of docker-compose
. If you are using DockerComposeV1, have this in mind.
-
Run
sudo apt-get install docker-compose-plugin
-
Check which versions are availables with
apt-cache madison docker-compose-plugin
-
Intall the version you are looking for with
sudo apt-get install docker-compose-plugin=<VERSION_STRING>
, for this reposudo apt install docker-compose-plugin=2.6.0~ubuntu-focal
was used. -
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 ^^
- v1.0 - Current - Repository created - 13/05/2023