diff --git a/.gitignore b/.gitignore index 39d0e24..76d0386 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ !/patches/ !/README.md !/tools/ +!/workspace.yml diff --git a/Makefile b/Makefile deleted file mode 100644 index 5d33bd9..0000000 --- a/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -default: init - -app-install: copy-required-files - docker-compose run --rm php vendor/bin/drush site:install -y \ - --existing-config \ - --site-name="Stream Demo" \ - --account-pass=admin123 - -copy-required-files: vendor - cp .env.example .env - cp .docker.env.example .docker.env - -init: copy-required-files start app-install - -start: copy-required-files - docker-compose up -d - -stop: - docker-compose down --remove-orphans - -vendor: composer.json composer.lock - docker-compose run --rm composer validate - docker-compose run --rm composer install diff --git a/README.md b/README.md index 592013a..d4ad0b9 100644 --- a/README.md +++ b/README.md @@ -23,38 +23,32 @@ Using Drupal's Composer Scaffold ### Starting the project -The project is using Docker and Docker Compose for local development. +The project is using Docker, Docker Compose and [Workspace](https://github.com/my127/workspace) for local development. -Run the `make` command to create the required files, download Drupal core, the additional contrib modules and PHP libraries, and install Drupal. +Once Workspace is installed, run `ws install` to create the required files, download Drupal core, the additional contrib modules and PHP libraries, and install Drupal. If you are using [Traefik](https://docs.traefik.io) (recommended), then the site should now be available at . ### Running Composer commands -Compser commands can be run via the `docker-compose run` command: +Compser commands can be run via the `ws composer` command: ``` -docker-compose run --rm composer +ws composer ``` For example, to add the Admin Toolbar module: ``` -docker-compose run --rm composer require drupal/admin_toolbar +ws composer require drupal/admin_toolbar ``` ### Running Drush commands -Drush commands can be run via the `docker-compose run` command: +Drush commands can be run via the `ws drush` command. For example, to rebuild the cache: ``` -docker-compose run --rm php vendor/bin/drush +ws drush cache:rebuild ``` -For example, to rebuild the cache: - -``` -docker-compose run --rm php vendor/bin/drush cache:rebuild -``` - -Alternatively, you could connect to the `php` container using `docker-compose exec php` and run `vendor/bin/drush ` within the container. +Alternatively, you could connect to the `php` container using `ws console` and run `vendor/bin/drush ` within the container. diff --git a/docker-compose.yaml b/docker-compose.yaml index 46d7994..8a38815 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -28,6 +28,8 @@ services: - .:/srv/app env_file: - .env + environment: + - DRUSH_OPTIONS_URI links: - mysql networks: diff --git a/workspace.yml b/workspace.yml new file mode 100644 index 0000000..a7bf164 --- /dev/null +++ b/workspace.yml @@ -0,0 +1,41 @@ +command('composer %'): | + #!bash|= + passthru "docker-compose run --rm composer ={ input.argument('%') }" + +command('console'): | + #!bash + passthru "docker-compose run --rm php bash" + +command('disable'): | + #!bash + run "docker-compose down --remove-orphans" + +command('destroy'): | + #!bash + run "docker-compose down --remove-orphans -v" + +command('drush %'): + env: + DRUSH_OPTIONS_URI: = @('app.url') + exec: | + #!bash|= + passthru "docker-compose run --rm php vendor/bin/drush ={ input.argument('%') }" + +command('enable'): | + #!bash + run "docker-compose up -d" + +command('install'): | + #!bash|@ + run "cp .docker.env.example .docker.env" + run "cp .env.example .env" + run "ws composer validate" + run "ws composer install" + run "ws enable" + run "ws drush site:install -y --existing-config --account-pass=@('admin.password')" + +attributes: + admin: + password: secret + app: + url: http://stream-demo.docker.localhost