El entorno de desarrollo esta configurado con docker siguiendo los pasos de los chicos de capisde
Prerequisites:
You will need to have docker installed at your system and running
Steps:
- Clone the repo
- Copy the env.example file to a new env file at the root of the project.
- Set the password for the database at the env file
- Build the containers:
docker-compose build
(add--no-cache
to avoid problems) - Run the containers:
docker-compose up -d
- Test at your browser that
http://localhost
is up and running.
Access to docker containers:
docker ps
to get all containers information.- 'docker exec -it "container_name" /bin/sh' to enter into the container.
Run manage.py:
- Enter to "etsy_web_1" container.
- 'cd' to "etsy/web/etsy/".
- 'python manage.py "command"'.
ATTENTION:
When 'docker-compose up', if database raises an error, check permissions in "postgres/docker-entrypoint-initdb.d/etsy_web.sh". Detected related error also when doing migrations. If the problem persits, try to:
- Enter to the postgres container.
- psql -U postgres -c "CREATE USER $DB_USER PASSWORD '$DB_PASS'"
- psql -U postgres -c "CREATE DATABASE $DB_NAME OWNER $DB_USER"
- Exit postgres container, enter to web's one and create superuser with 'python3 manage.py createsuperuser'
When 'docker-compose build' it may raise an error showing that "ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?", or similar. A solution to this may be adding docker to a security group, doing the following steps:
- 'sudo usermod -aG docker $USER'
- Login out and back in.