An small application that serves as an example of an autocomplete API using elasticsearch.
-
Install Docker - See Instalation
-
Install Docker Compose - See instalation
-
Ruby (2.6.3)
-
Rails (6.0.2.2)
-
PostgreSQL (10.12)
1.1. Starting the project
-
docker-compose up --build
-
docker-compose run web rails db:create
-
docker-compose run web rails db:migrate
-
docker-compose run web rails db:seed
After the configuration is finished the project can be started like any ohter rails project
rails s
After the server is started the swagger documentation can be seen at
localhost:3000/api-docs/index.html
We can also run the commands inside the containers using the command docker-compose run
, specifying a container. If I want to run as web
the specs, for example, I can use:
docker-compose run web bundle exec rspec
To stop a container running in the foreground, I use Ctrl-C
. To stop a container in the background, I drag:
docker-compose stop db web
To stop all active containers, I can run the command without arguments, as in:
docker-compose stop
Note, however, that the stop
command does not remove the containers, just to execute them. If I want to get into them again, I can use the docker-compose -f dev.yml up
command and it will start the same container where I was working. To remove containers individually, we can run:
docker-compose rm db web
And we can also remove everything with:
docker-compose down