Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
working yaml, model fix
Browse files Browse the repository at this point in the history
  • Loading branch information
janithcooray committed Jun 30, 2022
1 parent fa1b7b5 commit be776e3
Showing 1 changed file with 47 additions and 19 deletions.
66 changes: 47 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Docker Volume Sync for Faster Development on MacOS and Windows
---

## Pleast note that this is a pre-release, functionality is still partial! <br> Wait for a newer update!!

[![CodeQL](https://github.com/janithcooray/sync-stat/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/janithcooray/sync-stat/actions/workflows/codeql-analysis.yml)
[![Node.js Package](https://github.com/janithcooray/sync-stat/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/janithcooray/sync-stat/actions/workflows/npm-publish.yml)
---
## What it does

sync-stat is a docker volume Bind Mount Alternative that is on par with Bind mounts on Linux Based FSs in terms of performance for MacOS.(Windows NTFS support is comming soon)
sync-stat is an NPX CLI toolkit that offers an alternative to Docker Bind Mounts that is on par with Bind mounts on Linux Based FSs in terms of performance for MacOS.(Windows NTFS support is comming soon)

Docker with bind mounts can really cause a major performance penalty in MacOS (APPFS) and windows (NTFS)

Windows has WSL so it's not really effected but it would be nice if it would work as fast as bind mounts in linux in NTFS

sync-stat is an NPX CLi toolkit that offers an alternative to Bind Mounts.

sync-stat also offers some other options that docker cp / bind mounts do not offer. such as the ability to set an explicit user group and mode to the directory

Expand All @@ -23,13 +22,33 @@ sync-stat also offers some other options that docker cp / bind mounts do not off

### Install via NPM
```sh
npm install sync-stat
npm i sync-stat
```

## Configure - create `sync-compose.json`

create a JSON file named `sync-compose,json` at the root directory of your project
## Configure - create `sync-compose.yaml`

create a YAML file named `sync-compose.yaml` at the root directory of your project

```yaml
version: 1

containers: #Array
- name-of-container: #Array - must be defined in docker-compose or name container on start
volumes: # Bind Mounts - Array
- volume: # Item - config for each bind
from: app/ # From location relative to <ProjectRoot> => app/ || does not support ./app yet
to: /var/www/html/ # to location inside docker container
mode: 775 # Mode to write files
owner: www-data:www-data # owner to write files as
cmd: #Run the Following commands on start, this only runs 1 time
- npm install
- composer install
ignore: #ignore these directories when syncing
- node_modules/
replace: # replace these strings when copying
- "localhost:mysql-db"

```

## Example

Expand All @@ -41,24 +60,33 @@ services:
wordpress:
container_name: mytest-container
image: some-image #REPLACE
volumes:
volumes:
- ./app:/var/www/html # (IMPORTANT!) REMOVE THIS. sync-stat will Automaticall do this
# MOUNT CANNOT MATCH THE ONE IN SYNC-COMPOSE
# IF YOU DONT REMOVE THAT LINE, IT WILL CAUSE AN ERROR.
ports:
- "8000:80"
## application is placed at /var/www/html
```
sync-compose.json

```json
{
"containers":{
"mytest-container":{
"/var/www/html":"app"
}
}
}
sync-compose.yaml
```yaml
version: 1

containers:
- mytest-container:
volumes:
- volume:
from: app/
to: /var/www/html/
mode: 775
owner: www-data:www-data
cmd:
- echo hi
ignore:
- node_modules/
replace:
- "string:string"

```


Expand All @@ -69,7 +97,7 @@ sync-compose.json
make sure to name the container with matching names defined in the sync-compose.json

### Start Sync

Once Containers are online run the following in the root directory
```sh
npx sync-stat run
```

0 comments on commit be776e3

Please sign in to comment.