Skip to content

Commit

Permalink
Merge pull request #84 from EmakinaFR/feature/mutagen
Browse files Browse the repository at this point in the history
  • Loading branch information
duboiss committed Oct 26, 2023
2 parents 7f553f3 + d73af58 commit b1c1895
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 62 deletions.
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration-workflow.yml
Expand Up @@ -21,6 +21,7 @@ jobs:
run: docker-compose up -d
env:
COMPOSE_PROJECT_NAME: proximis
PROJECT_LOCATION: /

- name: "Display images & containers"
run: |
Expand Down
19 changes: 0 additions & 19 deletions Makefile
Expand Up @@ -56,7 +56,6 @@ ps: ## List all containers managed by the environment

purge: ## Purge all services and associated volumes
docker compose down -v
mutagen sync terminate --label-selector='name==${COMPOSE_PROJECT_NAME}'

restart: stop start ## Restart the environment

Expand All @@ -70,29 +69,11 @@ restore: ## Restore the "mysql" volume
start: ## Start the environment
@docker compose up --detach --remove-orphans

@if [[ ! "$$(mutagen sync list --label-selector='name==${COMPOSE_PROJECT_NAME}')" =~ "${COMPOSE_PROJECT_NAME}" ]]; then \
mutagen sync create \
--label=name="${COMPOSE_PROJECT_NAME}" \
--default-owner-beta="id:1000" \
--default-group-beta="id:1000" \
--mode="two-way-resolved" \
--ignore-vcs --ignore=".idea" \
"${PROJECT_LOCATION}" "docker://${COMPOSE_PROJECT_NAME}_synchro/var/www/html/"; \
else \
mutagen sync resume --label-selector='name==${COMPOSE_PROJECT_NAME}'; \
fi

@while [[ ! "$$(mutagen sync list --label-selector='name==${COMPOSE_PROJECT_NAME}')" =~ "Status: Watching for changes" ]]; do \
echo "Waiting for synchronization to complete..."; \
sleep 10; \
done

stats: ## Print real-time statistics about containers ressources usage
docker stats $(docker ps --format={{.Names}})

stop: ## Stop the environment
@docker compose stop
@mutagen sync pause --label-selector='name==${COMPOSE_PROJECT_NAME}'

.PHONY: backup build cache logs logs mysql nginx php ps purge restart restore start stats stop

Expand Down
26 changes: 1 addition & 25 deletions README.md
Expand Up @@ -6,35 +6,11 @@ This repository allows the creation of a Docker environment that meets
## Requirements

- [Docker](https://www.docker.com/)
- [Mutagen](https://mutagen.io/)

## Installation

This process assumes that [Docker Engine](https://www.docker.com/get-started) and [Docker Compose](https://docs.docker.com/compose/) are correctly installed.
Otherwise, you should have a look to the [installation documentation](https://docs.docker.com/install/) before proceeding further.

### Before installation

The only dependency required to run the environment is [Mutagen](https://mutagen.io/) which will synchronize your local files with docker's containers for maximize performances.
See the [installation documentation](https://mutagen.io/documentation/introduction/installation/) to install it on your system.

On Mac OS, simply run these following commands:

```bash
brew install mutagen-io/mutagen/mutagen
```

If you want that mutagen automatically starts with your system:

```bash
mutagen daemon register
```

You can also start it manually:

```bash
mutagen daemon start
```
Otherwise, you should have a look to the [installation documentation](https://docs.docker.com/install/) before proceeding further.

### Add the package to development requirements

Expand Down
12 changes: 2 additions & 10 deletions docker-compose.yml
Expand Up @@ -54,7 +54,7 @@ services:
- "443:443"
volumes:
# Projects files
- code_sync:/var/www/html:nocopy
- ${PROJECT_LOCATION}:/var/www/html:rw,delegated
# Websites configuration
- ${PROJECT_LOCATION}/docker/local/nginx.conf:/etc/nginx/conf.d/custom.conf:ro
# Logs
Expand All @@ -72,7 +72,7 @@ services:
- SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
volumes:
# Projects files
- code_sync:/var/www/html:nocopy
- ${PROJECT_LOCATION}:/var/www/html:rw,delegated
# Custom configuration
- ./php/conf.d/custom.ini:/usr/local/etc/php/conf.d/custom.ini:ro
# SSH socket
Expand All @@ -95,15 +95,7 @@ services:
- redis:/data
tty: true

synchro:
build:
context: ./synchro
container_name: ${COMPOSE_PROJECT_NAME}_synchro
volumes:
- code_sync:/var/www/html:nocopy

volumes:
code_sync: {}
elasticsearch: {}
mysql: {}
redis: {}
8 changes: 0 additions & 8 deletions synchro/Dockerfile

This file was deleted.

0 comments on commit b1c1895

Please sign in to comment.