Local Setup

In this guide, we will show you how to setup iCodeBetter locally using Docker.

You need to have Docker installed on your local machine. Open your terminal and run command docker network create icb to create a network. Database and web application containers need to be on the same network to communicate with each other.

Up-to-date images for database and web app are available on Docker Hub. Create this docker-compose.yml file given below on your local machine. On terminal, go to directory containing this docker compose file and run docker-compose up -d command. Restoring the database takes some time. So, web app container will restart a few times until database is ready (you can see it by running docker logs -f web). That's it, iCodeBetter will be running on localhost:8080.

docker-compose.yml
version: "3.4"
services:
db:
image: icodebetter/db_package
container_name: db
ports:
- "6666:5432"
restart: on-failure
volumes:
- "dbdata:/var/lib/postgresql/data"
networks:
- icb
web:
image: icodebetter/graal_image
container_name: web
ports:
- "8080:8080"
restart: on-failure
depends_on:
- db
networks:
- icb
networks:
icb:
external: true
volumes:
dbdata:
name: dbdata

Missing database tables error

Database may not be up-to-date. So, when you follow steps given above, you can encounter missing table error. Do the following to solve the problem.

Keep db container running. Delete web container and restart it with project=1 parameter:

docker container kill web
docker container prune -f
docker run -d -p 8080:8080 --network=icb --name=web icodebetter/graal_image project=1