Skip to content

makerist/mk_test_shop

Repository files navigation

Makerist test shop app

This app scaffold is generated by orats.

Setup

  1. Activate docker swarm mode

    docker swarm init
  2. Build and run the project with Docker Compose

    docker-compose up --build
  3. Reset and Migrate the database (run this in a 2nd Docker-enabled terminal)

    docker-compose exec website rails db:reset
    docker-compose exec website rails db:migrate

    Linux users have to set the user flag:

    docker-compose exec --user "$(id -u):$(id -g)" website rails db:reset
    docker-compose exec --user "$(id -u):$(id -g)" website rails db:migrate
    
  4. Visit http://localhost:3000

Developing

  1. Start the whole app docker-compose up

  2. Development as usual

    Make code changes. Reload page.

    If you have to run any tasks inside the container use docker-compose exec <service-name> <cmd>:

    docker-compose exec website rails db:migrate

    To open a console in a container:

    docker-compose exec website sh
  3. Stop all services

    1. Variant a: run in a separate terminal window (same directory) to clean up all: docker-compose up
    2. Variant b: press Ctrl+C in the running terminal (containers are not removed)

Test production mode

docker stack deploy shop -c docker-compose.yml

Use portainer as a docker web UI

  1. docker volume create portainer_data

  2. start portainer

    1. As a single container:

      docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
    2. As a docker swarm service (prefered)

      docker service create \
          --name portainer \
          -p 9000:9000 \
          --constraint 'node.role == manager' \
          --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
          --mount type=volume,src=portainer_data,dst=/data \
          portainer/portainer -H unix:///var/run/docker.sock

Troubleshooting

  1. If you get an rack time-out error, set the env var RACK_REQUEST_TIMEOUT to 20 in .env. It's caused by the assets compiling running for the first time.

About

Example app to test docker orchestration frameworks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •