Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export COMPOSE_DOCKER_CLI_BUILD=1
# take it form env, or from env file
COMPOSE_PROJECT_NAME ?= $(shell grep COMPOSE_PROJECT_NAME ${ENV_FILE} | cut -d '=' -f 2)

# allows to commands with sudo if needed
# SUDO=sudo make up
SUDO ?=

# load env variables
# also takes into account envrc (direnv file)
ifneq (,$(wildcard ./${ENV_FILE}))
Expand All @@ -19,8 +23,9 @@ ifneq (,$(wildcard ./${ENV_FILE}))
export
endif

DOCKER_COMPOSE=docker compose --env-file=${ENV_FILE}
DOCKER_COMPOSE_TEST=COMPOSE_PROJECT_NAME=search_test docker compose --env-file=${ENV_FILE}
DOCKER = $(SUDO) docker
DOCKER_COMPOSE = $(DOCKER) compose --env-file=${ENV_FILE}
DOCKER_COMPOSE_TEST = $(SUDO) COMPOSE_PROJECT_NAME=search_test $(DOCKER_COMPOSE)

.PHONY: build create_external_volumes livecheck up down test test_front test_front_watch test_api import-dataset import-taxonomies sync-scripts build-translations generate-openapi check check_front check_translations lint lint_back lint_front
#------------#
Expand All @@ -35,15 +40,15 @@ create_external_volumes:
echo creating docker volume $$vol_name \
# create volume \
# this bind mount a folder, it will happen when volume will be used \
docker volume create --driver=local "$$vol_name" ; \
${DOCKER} volume create --driver=local "$$vol_name" ; \
done;

livecheck:
@echo "🔎 livecheck services…" ; \
exit_code=0; \
services=`${DOCKER_COMPOSE} config --service | tr '\n' ' '`; \
for service in $$services; do \
if [ -z `docker compose ps -q $$service` ] || [ -z `docker ps -q --no-trunc | grep $$(${DOCKER_COMPOSE} ps -q $$service)` ]; then \
if [ -z `${DOCKER} compose ps -q $$service` ] || [ -z `${DOCKER} ps -q --no-trunc | grep $$(${DOCKER_COMPOSE} ps -q $$service)` ]; then \
echo "$$service: DOWN"; \
exit_code=1; \
else \
Expand Down Expand Up @@ -75,7 +80,7 @@ down:
${DOCKER_COMPOSE} down

_ensure_network:
docker network inspect ${COMMON_NET_NAME} >/dev/null || docker network create -d bridge ${COMMON_NET_NAME}
${DOCKER} network inspect ${COMMON_NET_NAME} >/dev/null || ${DOCKER} network create -d bridge ${COMMON_NET_NAME}

#--------#
# Checks #
Expand Down
15 changes: 11 additions & 4 deletions docs/users/how-to-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,17 @@ You should now be able to start docker:
docker compose up -d
```

> [!NOTES]
> * You may encounter a permission error if your user is not part of the `docker` group, in which case you should either [add it](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) or modify the Makefile to prefix `sudo` to all docker and docker compose commands.
> * Update container might crash because if you are note connected to any Redis, Search-a-licious will still run. You need to connect to Redis only if you want continuous updates. See [How to update the index](./how-to-update-index.md)

> [!NOTE]
> You may encounter a permission error if your user is not part of the `docker` group.
> In that case you should set the `SUDO` env variable to `sudo`:
>
> ```console
> export SUDO=sudo
> make build
> ```

> [!NOTE]
> Update container might crash because if you are note connected to any Redis, Search-a-licious will still run. You need to connect to Redis only if you want continuous updates. See [How to update the index](./how-to-update-index.md)

## Using it

Expand Down
Loading