Skip to content

Commit

Permalink
Revert "Modify csu script and docker setup for OSX compatability (fixes
Browse files Browse the repository at this point in the history
#651)"

This reverts commit f1ee519.
  • Loading branch information
jordangriffiths01 committed Nov 9, 2017
1 parent fd903f2 commit 99f8eac
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 28 deletions.
1 change: 0 additions & 1 deletion Dockerfile-local
Expand Up @@ -17,7 +17,6 @@ COPY requirements /requirements
# Install dependencies
RUN /docker_venv/bin/pip3 install -r /requirements/local.txt


RUN mkdir /cs-unplugged/
RUN mkdir /cs-unplugged/csunplugged/
WORKDIR /cs-unplugged/csunplugged/
Expand Down
27 changes: 5 additions & 22 deletions csu
Expand Up @@ -79,10 +79,7 @@ cmd_end() {
docker-compose down
echo
echo "Deleting system volumes..."
volumes=($(docker volume ls -qf dangling=true ))
for volume in "${volumes[@]}"; do
docker volume rm "${volume}"
done
docker volume ls -qf dangling=true | xargs -r docker volume rm
}
defhelp end 'Stop development environment.'

Expand Down Expand Up @@ -179,10 +176,7 @@ dev_build() {
docker-compose build
echo
echo "Deleting untagged images..."
untagged_images=($(docker images --no-trunc | grep '<none>' | awk '{print $3}'))
if [[ ${#untagged_images[@]} -gt 0 ]]; then
docker rmi "${untagged_images[@]}"
fi
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
}
defhelp -dev build 'Build or rebuild Docker images.'

Expand Down Expand Up @@ -284,24 +278,13 @@ cmd_clean() {

echo
echo "Deleting unused volumes..."

unused_volumes=($(docker volume ls -qf dangling=true))
for vol in "${unused_volumes[@]}"; do
docker volume rm "${vol}"
done

docker volume ls -qf dangling=true | xargs -r docker volume rm
echo
echo "Deleting exited containers..."
exited_containers=($(docker ps --filter status=dead --filter status=exited -aq))
for container in "${exited_containers[@]}"; do
docker rm -v "${container}"
done
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
echo
echo "Deleting dangling images..."
dangling_images=($(docker images -f "dangling=true" -q))
if [[ ${#dangling_images[@]} -gt 0 ]]; then
docker rmi "${dangling_images[@]}"
fi
docker images -f "dangling=true" -q | xargs docker rmi
}
defhelp clean 'Delete unused Docker files.'

Expand Down
2 changes: 1 addition & 1 deletion csunplugged/docker-development-entrypoint.sh
Expand Up @@ -5,7 +5,7 @@ function postgres_ready(){
import sys
import psycopg2
try:
conn = psycopg2.connect(dbname="postgres", user="postgres", host="postgres", port="5434")
conn = psycopg2.connect(dbname="postgres", user="postgres", host="localhost", port="5434")
except psycopg2.OperationalError:
sys.exit(-1)
sys.exit(0)
Expand Down
7 changes: 4 additions & 3 deletions docker-compose.yml
Expand Up @@ -5,6 +5,7 @@ services:
image: postgres:9.6.5
# Set port to non-standard value to not use Travis CI Postgres server.
command: postgres -p 5434
network_mode: host

django:
build:
Expand All @@ -16,10 +17,11 @@ services:
environment:
- PORT=8080
- USE_DOCKER=yes
- DATABASE_URL=postgres://postgres@postgres:5434/postgres
- DATABASE_URL=postgres://postgres@localhost:5434/postgres
- DJANGO_SETTINGS_MODULE=config.settings.local
depends_on:
- postgres
network_mode: host

nginx:
build:
Expand All @@ -30,5 +32,4 @@ services:
- /app/node_modules
depends_on:
- django
ports:
- "80:80"
network_mode: host
2 changes: 1 addition & 1 deletion infrastructure/nginx/nginx.conf
Expand Up @@ -25,7 +25,7 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://django:8080;
proxy_pass http://localhost:8080;
}
}
}

0 comments on commit 99f8eac

Please sign in to comment.