Skip to content

Commit

Permalink
Add bat files (#5)
Browse files Browse the repository at this point in the history
* Add bat files

* Review readme
  • Loading branch information
LSantos-PT authored and ricardoamaro committed Jun 26, 2018
1 parent 0141d0b commit f056260
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ drupal8-docker-app
- [3 - Visit Drupal 8 in your browser](#3---visit-drupal-8-in-your-browser)
- [Extra - Visualize MySQL tables in your browser](#extra---visualize-mysql-tables-in-your-browser)
- [COMMUNITY CONTRIBUTIONS](#community-contributions)
- [Using `drupal8_local.sh` for local development](#using-drupal8localsh-for-local-development)
- [Using `drupal8_local.sh` or `drupal8_local.bat` for local development](#using-drupal8localsh-or-drupal8localbat-for-local-development)
- [Fresh install](#fresh-install)
- [Credentials (will be shown in the output)](#credentials-will-be-shown-in-the-output)
- [Stoping and starting Drupal8-docker-app](#stoping-and-starting-drupal8-docker-app)
Expand Down Expand Up @@ -74,13 +74,21 @@ Credentials (user/pass): admin/admin
If you want **Code and Database persistence** with Drupal8 code
on the `local/web` folder and MySQL on the `local/data` folder:

### Linux/Mac Users
```
git clone https://github.com/ricardoamaro/drupal8-docker-app.git
cd drupal8-docker-app
./drupal8_local.sh
```

## Using `drupal8_local.sh` for local development
### Windows Users
```
git clone https://github.com/ricardoamaro/drupal8-docker-app.git
cd drupal8-docker-app
drupal8_local.bat
```

## Using `drupal8_local.sh` or `drupal8_local.bat` for local development

### Fresh install

Expand All @@ -90,7 +98,7 @@ For a fresh install or re-install of your existing code
2. Create a `local/web/` folder with your Drupal 8 docroot
eg. `composer create-project drupal-composer/drupal-project:8.x-dev local --no-interaction`
3. Delete the `sites/default/settings.php` file
4. Run `drupal8_local.sh`
4. Run `drupal8_local.sh` to linux/mac users or `drupal8_local.bat` to windows users

### Credentials (will be shown in the output)
* Drupal account-name=admin & account-pass=admin
Expand All @@ -102,7 +110,7 @@ For a fresh install or re-install of your existing code
To stop and restart the installed existing site

1. Press CTRL+C on the console showing the logs
2. Run `drupal8_local.sh` on the same directory
2. Run `drupal8_local.sh` or `drupal8_local.bat` on the same directory
3. Open the site URL mentioned in the console

### Example usage for testing:
Expand Down
20 changes: 20 additions & 0 deletions drupal8_local.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:: Note: LOCAL can be something else for several sites running from the console
:: eg. drupal8_local.bat LOCAL
@echo off

mkdir %1%\web
mkdir %1%\data

:: Create a random LOCAL ports for the container
@SET /a "WEBPORT = %RANDOM% * (50000 - 10000 + 1) / 32768 + 10000"
@SET /a "DBPORT = %RANDOM% * (50000 - 10000 + 1) / 32768 + 10000"

echo **** Starting Drupal using persistence on %1%/ folder ****
echo Using MYSQL PORT: %DBPORT%
echo Using HTTP URL : http://localhost:%WEBPORT%

:: Create a network
docker network create --subnet=10.8.8.0/16 drupalnet

:: Run the container
docker run -it --net drupalnet --volume=%cd%\%1\data:/var/lib/mysql --volume=%cd%\%1:/var/www/html -p %WEBPORT%:80 -p %DBPORT%:3306 ricardoamaro/drupal8
13 changes: 13 additions & 0 deletions drupal8_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:: Create a random local ports for the container
@SET /a "WEBPORT = %RANDOM% * (50000 - 10000 + 1) / 32768 + 10000"
@SET /a "DBPORT = %RANDOM% * (50000 - 10000 + 1) / 32768 + 10000"

echo **** Starting Drupal Trial Test Run with ephemeral data ****
echo Using MYSQL PORT: %DBPORT%
echo Using HTTP URL : http://localhost:%WEBPORT%

:: Create a network
docker network create --subnet=10.8.8.0/16 drupalnet

:: Run the container
docker run -it --net drupalnet -p ${WEBPORT}:80 -p ${DBPORT}:3306 ricardoamaro/drupal8

0 comments on commit f056260

Please sign in to comment.