Skip to content
This repository has been archived by the owner on Feb 28, 2018. It is now read-only.

Setup a new way to compose containers #137

Closed
wants to merge 13 commits into from

Conversation

pedrommone
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f6bcac4 on pedrommone:cuducos-elm-to-nginx into ** on datasciencebr:cuducos-elm-to-nginx**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling ca2052f on pedrommone:cuducos-elm-to-nginx into ** on datasciencebr:cuducos-elm-to-nginx**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling ca2052f on pedrommone:cuducos-elm-to-nginx into ** on datasciencebr:cuducos-elm-to-nginx**.

@cuducos cuducos changed the base branch from cuducos-elm-to-nginx to master January 19, 2017 00:07
@@ -6,7 +6,6 @@ services:
context: .
dockerfile: Dockerfile
volumes:
- "./:/code"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this to keep developing using yarn watch

volumes:
- "./:/code"
- "/code/node_modules"
command: [yarn, watch]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ideia is keep development in default docker-compose file.

@cuducos
Copy link
Collaborator

cuducos commented Jan 19, 2017

@gomex and @petriuslima — Pedro's PR fixes some bug we had in the current Docker environment (compiled files from Elm container was missing for nginx container). However it changes a bit the way things work. For production the docker-compose.yml is the base, and you load the docker-develop.yml that adds certain configuration that should make it a proper development environment. Does that make sense, can we merge it?

@gomex
Copy link
Contributor

gomex commented Jan 19, 2017

@cuducos IMHO development opinion should be easy to use. In that case docker-compose.yml should be for dev.

About that Prod vs Dev env I already sent this PR #129

@cuducos
Copy link
Collaborator

cuducos commented Jan 19, 2017

Ok… we have three scenarios here:

  • master was supposed to be focused on dev, but it was broken
  • Introducing docker prod environment  #129 introduced Docker for production, but as it was based on master development was still broken
  • Now we have a third approach (this PR) that attempts to fix both

I do agree that development should be easy to use, and that production should be made via Docker too — this is our target. I'm just not experienced enough to fix all Docker issues and to ponder on these three scenarios.

Today I'll try #129 for dev and prod, and this PR #137 for dev and prod on a fresh machine and gonna update you all.

@cuducos
Copy link
Collaborator

cuducos commented Jan 19, 2017

Hi all,

I tested this PR 3 times for dev 3 times for prod, on a fresh VM. No good news — and I have no idea what we did yesterday that make it work.

Production

django.db.utils.OperationalError: could not connect to server: Connection refused
	Is the server running on host "db" (172.20.0.2) and accepting
	TCP/IP connections on port 5432?

But the PostgreSQL container was up:

$ docker-compose ps
     Name                    Command               State                Ports
-----------------------------------------------------------------------------------------
jarbas_cache_1    docker-entrypoint.sh memcached   Up       11211/tcp
jarbas_db_1       /docker-entrypoint.sh postgres   Up       5432/tcp
jarbas_elm_1      /bin/sh -c yarn assets           Exit 0
jarbas_jarbas_1   gunicorn jarbas.wsgi:appli ...   Up
jarbas_nginx_1    nginx -g daemon off;             Up       443/tcp, 0.0.0.0:8000->80/tcp

This test routine was as follows:

git clone https://github.com/datasciencebr/jarbas.git && \
cd jarbas && \
git pull https://github.com/pedrommone/jarbas.git cuducos-elm-to-nginx && \
sed 's/127.0.0.1/138.197.13.210/g' contrib/.env.sample > .env && \
docker-compose up -d --build && \
docker-compose run --rm jarbas python manage.py migrate && \
docker-compose run --rm jarbas python manage.py ceapdatasets && \
docker-compose run --rm jarbas python manage.py collectstatic --no-input

I've seen this database situation a couple of times in Docker and I know that usually re-running stuff fixes it. However in my three tests I ended up there.

Development

The three times I trie to build a development environment the database issue was gone. But it failed to serve the static folder:

$ curl -I localhost:8000/static/app.js
HTTP/1.1 404 Not Found
Server: nginx/1.11.5
Date: Thu, 19 Jan 2017 15:02:15 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive

This test routine was as follow:

git clone https://github.com/datasciencebr/jarbas.git && \
cd jarbas && \
git pull https://github.com/pedrommone/jarbas.git cuducos-elm-to-nginx && \
sed 's/DEBUG=False/DEBUG=True/g' contrib/.env.sample > .env && \
sed 's/127.0.0.1/138.197.13.210/g' .env > .env && \
docker-compose -f docker-compose.yml -f docker-develop.yml up -d --build && \
docker-compose run --rm jarbas python manage.py migrate && \
docker-compose run --rm jarbas python manage.py ceapdatasets && \
docker-compose run --rm jarbas python manage.py collectstatic --no-input

@cuducos
Copy link
Collaborator

cuducos commented May 10, 2017

Closing by a) inactivity and to b) focus on the active Docker-related PR #163

@cuducos cuducos closed this May 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants