Instalação e configuração ambiente de desenvolvimento com Docker (Linux) - scieloorg/template-scms GitHub Wiki

Prerequisites:

  • Docker (This doc was generated with Docker version 20.10.11, build dea9396e18)
  • Git (This doc was generated with git version 2.34.1)
  • Bash (This doc was generated with versão 5.1.12(1)-release)
  • Python > 3.5 in the host (optional)

Instalation:

  1. Download the template from repository:
git clone https://github.com/scieloorg/template-scms.git

This command will download the code to template-scms folder.

  1. Enter to folder
cd template-scms
  1. Look that exist a Makefile in the template-folder
ls -lahrt
  1. Just to know the shortcuts in the Makefile, run:
make help
  1. In this installation, we will focus on development environment, so we will use a local.yml deployment file, run:
make build # This is the same as docker-compose -f local.yml build

Wait depend on the host this can take a while!!!

With the command, we create the images to docker, look:

core_local_docs                                    latest              72d755dd801a   About a minute ago   531MB
core_local_postgres                                latest              24bd66e9b2a0   3 minutes ago        374MB
core_local_celerybeat                              latest              a88a2695f9bd   4 minutes ago        574MB
core_local_celeryworker                            latest              a88a2695f9bd   4 minutes ago        574MB
core_local_django                                  latest              a88a2695f9bd   4 minutes ago        574MB
core_local_flower                                  latest              a88a2695f9bd   4 minutes ago        574MB

Note the middle name for all the images that are local indicates a development image.

  1. Now it's possible to run the application.
make up # This is the same as docker-compose -f local.yml up

This command will download the images doesn't exists in local images, like redis and pgbouncer.

The result of this command:

[+] Running 9/9
 ⠿ Container core_local_postgres      Started                                                                                                                                                                                                                              0.9s
 ⠿ Container core_local_mailhog       Started                                                                                                                                                                                                                              0.9s
 ⠿ Container core_local_docs          Started                                                                                                                                                                                                                              0.6s
 ⠿ Container core_local_redis         Started                                                                                                                                                                                                                              0.7s
 ⠿ Container core_local_celeryworker  Started                                                                                                                                                                                                                              2.5s
 ⠿ Container core_local_django        Started                                                                                                                                                                                                                              2.8s
 ⠿ Container core_local_celerybeat    Started                                                                                                                                                                                                                              2.5s
 ⠿ Container core_local_flower        Started                                                                                                                                                                                                                              2.7s
 ⠿ Container core_local_pgbouncer     Started
  1. To see the containers runnig, execute:
make ps # Same as docker ps -a

The result of this command:

NAME                      COMMAND                  SERVICE             STATUS              PORTS
core_local_celerybeat     "/entrypoint /start-…"   celerybeat          running
core_local_celeryworker   "/entrypoint /start-…"   celeryworker        running
core_local_django         "/entrypoint /start"     django              running             0.0.0.0:8000->8000/tcp, :::8000->8000/tcp
core_local_docs           "/start-docs"            docs                running             0.0.0.0:9000->9000/tcp, :::9000->9000/tcp
core_local_flower         "/entrypoint /start-…"   flower              running             0.0.0.0:5555->5555/tcp, :::5555->5555/tcp
core_local_mailhog        "MailHog"                mailhog             running             0.0.0.0:8025->8025/tcp, :::8025->8025/tcp
core_local_pgbouncer      "/entrypoint.sh /usr…"   pgbouncer           running             0.0.0.0:6434->5432/tcp, :::6434->5432/tcp
core_local_postgres       "docker-entrypoint.s…"   postgres            running             0.0.0.0:5432->5432/tcp, :::5432->5432/tcp
core_local_redis          "docker-entrypoint.s…"   redis               running             6379/tcp
  1. Now this possible to see the solution in the browser.

Access: http://localhost:8000

The result of this access must be:

Captura de Tela 2022-06-07 às 08 51 25