source sync
parent
f5d33866cc
commit
428e5ad3f0
|
@ -0,0 +1,76 @@
|
||||||
|
# Development
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
* Clone [rodber/chevereto-free](https://github.com/rodber/chevereto-free)
|
||||||
|
* Run [docker-compose up](#up)
|
||||||
|
* [Sync code](#sync-code) to sync changes
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
|
||||||
|
* `SOURCE` is the absolute path to the cloned chevereto project
|
||||||
|
* You need to replace `SOURCE=~/git/rodber/chevereto-free` with your own path
|
||||||
|
* `SOURCE` will be mounted at `/var/www/source/` inside the container
|
||||||
|
* Chevereto will be available at [localhost:8910](http://localhost:8910)
|
||||||
|
|
||||||
|
✨ This dev setup mounts `SOURCE` to provide the application files to the container. We provide a sync system that copies these files on-the-fly to the actual application runner for better isolation.
|
||||||
|
|
||||||
|
## docker-compose
|
||||||
|
|
||||||
|
Compose file: [httpd-php-dev.yml](../httpd-php-dev.yml)
|
||||||
|
|
||||||
|
Alter `SOURCE` in the commands below to reflect your project path.
|
||||||
|
|
||||||
|
## Up
|
||||||
|
|
||||||
|
Run this command to spawn (start) Chevereto Installer.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
SOURCE=~/git/rodber/chevereto-free \
|
||||||
|
docker-compose \
|
||||||
|
-p chevereto-free-dev \
|
||||||
|
-f httpd-php-dev.yml \
|
||||||
|
up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
## Stop
|
||||||
|
|
||||||
|
Run this command to stop Chevereto Installer.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
SOURCE=~/git/rodber/chevereto-free \
|
||||||
|
docker-compose \
|
||||||
|
-p chevereto-free-dev \
|
||||||
|
-f httpd-php-dev.yml \
|
||||||
|
stop
|
||||||
|
```
|
||||||
|
|
||||||
|
## Down (uninstall)
|
||||||
|
|
||||||
|
Run this command to down Chevereto (stop containers, remove networks and volumes created by it).
|
||||||
|
|
||||||
|
```sh
|
||||||
|
SOURCE=~/git/rodber/chevereto-free \
|
||||||
|
docker-compose \
|
||||||
|
-p chevereto-free-dev \
|
||||||
|
-f httpd-php-dev.yml \
|
||||||
|
down --volumes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sync code
|
||||||
|
|
||||||
|
Run this command to sync the application code with your working project.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker exec -it \
|
||||||
|
chevereto-free-dev_app \
|
||||||
|
bash /var/www/sync.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This system will observe for changes in your working project filesystem and it will automatically sync the files inside the container.
|
||||||
|
|
||||||
|
**Note:** This command must keep running to provide the sync functionality. You should close it once you stop working with the source.
|
||||||
|
|
||||||
|
## Logs
|
||||||
|
|
||||||
|
`todo`
|
|
@ -25,7 +25,7 @@ services:
|
||||||
- app:/var/www/html/
|
- app:/var/www/html/
|
||||||
- type: bind
|
- type: bind
|
||||||
source: ${SOURCE}
|
source: ${SOURCE}
|
||||||
target: /var/www/chevereto
|
target: /var/www/chevereto-free
|
||||||
ports:
|
ports:
|
||||||
- 8910:80
|
- 8910:80
|
||||||
restart: always
|
restart: always
|
||||||
|
|
|
@ -71,7 +71,6 @@ RUN set -eux; \
|
||||||
|
|
||||||
VOLUME /var/www/html
|
VOLUME /var/www/html
|
||||||
VOLUME /var/www/html/images
|
VOLUME /var/www/html/images
|
||||||
VOLUME /var/www/source
|
|
||||||
|
|
||||||
COPY . /var/www/html
|
COPY . /var/www/html
|
||||||
RUN rm /var/www/html/sync.sh
|
RUN rm /var/www/html/sync.sh
|
||||||
|
|
14
sync.sh
14
sync.sh
|
@ -1,22 +1,18 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
SOURCE=/var/www/source/
|
SOURCE=/var/www/chevereto-free/
|
||||||
INSTALLER=/var/www/installer/
|
|
||||||
TARGET=/var/www/html/
|
TARGET=/var/www/html/
|
||||||
EXCLUDE="\.git|\.DS_Store|\/docs"
|
EXCLUDE="\.git|\.DS_Store|\/docs"
|
||||||
mkdir -p $INSTALLER
|
cp "${SOURCE}".gitignore "${TARGET}".gitignore
|
||||||
cp "${SOURCE}".gitignore "${INSTALLER}".gitignore
|
|
||||||
function sync() {
|
function sync() {
|
||||||
rsync -r -I -og \
|
rsync -r -I -og \
|
||||||
--chown=www-data:www-data \
|
--chown=www-data:www-data \
|
||||||
--info=progress2 \
|
--info=progress2 \
|
||||||
--filter=':- .gitignore' \
|
--filter=':- .gitignore' \
|
||||||
--exclude '.git' \
|
--filter=':- .dockerignore' \
|
||||||
|
--exclude '.git sync.sh' \
|
||||||
--delete \
|
--delete \
|
||||||
$SOURCE $INSTALLER
|
$SOURCE $TARGET
|
||||||
# php "${INSTALLER}"src/build.php
|
|
||||||
# cp "${INSTALLER}"build/installer.php "${TARGET}"installer.php
|
|
||||||
# chown www-data: $TARGET -R
|
|
||||||
}
|
}
|
||||||
sync
|
sync
|
||||||
inotifywait \
|
inotifywait \
|
||||||
|
|
Loading…
Reference in New Issue