This repository is using Amazee's containers.
- Git
- Docker
Only on Linux and macOS.
To install pygmy
, run gem install pygmy
.
This is only needed if you don't already have pygmy
installed.
Start pygmy: pygmy up
docker run --rm -it -v $PWD:/app --user $(id -u):$(id -g) tamasd/composer \
create-project Pronovix/devportal-starterkit \
-s dev $DEVPORTAL_NAME
This command will create the project files with the containers.
It is possible that there will be some error output about missing the gd
extension.
These errors can be ignored.
- Copy
docker-compose.unix.yml
ordocker-compose.windows.yml
asdocker-compose.override.yml
, depending on the host operating system. - Then run
docker-compose up --build -d
docker-compose run --rm cli sh -c 'composer install'
- Create your settings.local.php file:
cp web/sites/example.settings.local.php web/sites/default/settings.local.php
- Create your settings.php file:
cp web/sites/default/default.settings.php web/sites/default/settings.php
- Uncomment the inclusion of
settings.local.php
from the bottom ofweb/sites/default/settings.php
. - Add the following code to settings.local.php:
If you use MariaDB:
$databases['default']['default'] = [
'database' => 'drupal',
'username' => 'drupal',
'password' => 'drupal',
'prefix' => '',
'host' => 'mariadb',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
];
If you use Postgres:
$databases['default']['default'] = [
'database' => 'drupal',
'username' => 'drupal',
'password' => 'drupal',
'prefix' => '',
'host' => 'postgres',
'port' => '5432',
'namespace' => 'Drupal\\Core\\Database\\Driver\\pgsql',
'driver' => 'pgsql',
];
Add the following snippet as well.
$settings['trusted_host_patterns'] = [
'^$PROJECT.docker.amazee.io$',
'^nginx.$PROJECT.docker.amazee.io$',
'^nginx$',
'^localhost$',
];
if (!drupal_installation_attempted()) {
$settings['cache']['default'] = 'cache.backend.redis';
$settings['redis.connection']['host'] = 'redis';
$settings['container_yamls'][] = 'modules/contrib/redis/example.services.yml';
$settings['container_yamls'][] = 'modules/contrib/redis/redis.services.yml';
$class_loader->addPsr4('Drupal\\redis\\', 'modules/contrib/redis/src');
$settings['bootstrap_container_definition'] = [
'parameters' => [],
'services' => [
'redis.factory' => [
'class' => 'Drupal\redis\ClientFactory',
],
'cache.backend.redis' => [
'class' => 'Drupal\redis\Cache\CacheBackendFactory',
'arguments' => ['@redis.factory', '@cache_tags_provider.container', '@serialization.phpserialize'],
],
'cache.container' => [
'class' => '\Drupal\redis\Cache\PhpRedis',
'factory' => ['@cache.backend.redis', 'get'],
'arguments' => ['container'],
],
'cache_tags_provider.container' => [
'class' => 'Drupal\redis\Cache\RedisCacheTagsChecksum',
'arguments' => ['@redis.factory'],
],
'serialization.phpserialize' => [
'class' => 'Drupal\Component\Serialization\PhpSerialize',
],
],
];
}
$config_directories['sync'] = '../config/sync';
- After adding this snippet to
settings.local.php
look up the lagoon project name fromdocker-compose.yml
(e.g.starterkit
instarterkit.docker.amazee.io
), and replace$PROJECT
with it. - Inside the
cli
container, rundrush si $PROFILE --account-name=admin --account-pass=admin
where$PROFILE
can be eitherconfig_installer
(if you already have configuration insideconfig/sync
) orstandard
(completely new project). Wait until your site gets installed. (This step can be skipped if you would like to import an existing database).
While it is not strictly necessary to enable the redis module, it is recommended to do so.
- Extract the downloaded public files archive:
tar -zxvf files.tgz
- Copy the content to the public files location:
sudo rsync -av --delete files/ /path/to/project/web/sites/default/files
- Copy the database to the project's web folder:
cp database.sql.gz /path/to/project
- Go to the project directory:
cd /path/to/project
- Import the database with drush:
docker-compose run --rm cli sh -c 'zcat database.sql.gz | drush sqlc'
.
-
docker-compose run --rm cli sh
To run commands inside the container.
-
docker-compose up -d
Starts the containers.
-
docker-compose stop
Shuts down the containers (keeps the state).
-
docker-compose down
Destroys the containers (permanently deletes the state).
Copy .env.js
as env.js
into the project root from
the Gulp component and and set your local
theme paths.
- Build CSS:
docker-compose run --rm gulp sh -c 'npm run gulp'
- Watch SCSS changes:
docker-compose run --rm gulp sh -c 'npm run gulp watch'
- Non-minified CSS with source maps:
docker-compose run --rm gulp sh -c 'npm run gulp watch -- --debug'
(standalone--
is needed to pass an argument to Gulp)
See the the Gulp component for a troubleshooting guide.
As Windows does not support Pygmy (which handles Mailhog on Linux/Mac), Mailhog
should be added separately as container (see docker-compose.windows.yml). After
installing it with docker-compose up -d
you can reach Mailhog by visiting http://localhost:8025/ in your browser.
Open docker-compose.override.yml
and follow the instructions in the cli
and
php
sections.
docker-compose -f docker-compose.yml \
-f docker-compose.tests.yml -f docker-compose.override.yml \
run --rm tests