-
Notifications
You must be signed in to change notification settings - Fork 0
Using Docker
The Docker Cook Maker produces 4 containers via docker-compose :
- postgres : the postgres container providing full access to a local postgres database
- redis : the redis container providing full access to a local redis database
- api : the container in charge to execute the rails server for the generated api
- frontend : the container in charge to execute de node server for the generated frontend

For linux based developpers, we need to give access to docker for non-root user. Either you will need to add sudo to all of the commands below.
# Add the docker group if it doesn't already exist
sudo groupadd docker
# Add the connected user "$USER" to the docker group. Change the user name to match your preferred user if
# you do not want to use your current user
sudo gpasswd -a $USER dockerEither do a newgrp docker or log out/in to activate the changes to groups.
You can test if all is ok by running :
docker run hello-worldFor a first install or an example test, just follow this commands.
# Cloning Cook Maker locally
git clone https://github.com/TheRealCodeKraft/cook-maker
# Cook a new example app
./cook-maker/docker/cook -a example
# Go to the fresh example folder
cd example
# Build the example app
./tools/cook-build
# Launch the example app
./tools/cook-up -d
# Create db Schema
./tools/cook-db
# Seed the database
./tools/cook-seedAfter that, just connect to http://localhost:3002 and magic will appear !
# Cloning Cook Maker locally
git clone https://github.com/TheRealCodeKraft/cook-maker# Build the docker image
./cook-maker/docker/cook -a exampleor
docker build -t cook-maker /path_to_cook-maker/docker
# Go to your projet base camp
cd ~/Projects
# Run the cook maker
docker run -it -v $(pwd):/build -e name=example --name cook-maker-example cook-makerJust replace example with your own app name.
It will results on a directory called with your app name (e.g. example) containing two folders named api and frontend.
For launching a cooked app, go to your projet folder with cd ~/Projects/example and then :
# Build dockers containers
./tools/cook-buildor
docker-compose -f tools/docker-compose.yml build# Launch the whole app
./tools/cook-upor
docker-compose -f tools/docker-compose.yml upAttention The app must be up to create and seed database !
For first launch, you will create the base database and seed id. If you are linux based developper, just use ./cook-db and ./cook-seed,else :
# Create the database
./tools/cook-dbor
docker-compose -f tools/docker-compose.yml run api rake db:migrate# Seed the database
./tools/cook-seedor
docker-compose -f tools/docker-compose.yml run api rake db:seed
You will be now able to connect on http://localhost:3002.
A default admin user is set up. You can find the defaut data in api/.codekraftrc.