BC
Monday, 28 February 2022
Monday, 15 November 2021
Friday, 17 May 2019
CK
dupa
Password: Hello@DN0826
Right after that go to: admin/config/regional/translate/settings and set "Source translations" to "Only local files". Then export this config and install drupal. There are several ways to import translation during installtion, but none of these worked for me. There always has been an issue with it. I found somewhere in install.core.inc file that default location of translation files is /files/translations but it didn't work for some reason. Placing translations in profile dir also didn't work. The only one setting that worked was to set up the path in file system. I suppose this might be involved with install from config. This needs to be part of config to make it work. Drupal treats "install from config" process as it has everything you need, so if this path is not set it's not gonna work. I also tried to override this path with:
$config['locale.settings']['translation']['path'] = $app_root . '/sites/default/files/translations';
but it also didn't work.
Manufaktura was enabled on Lando due to issue with MySQL8 which is not supported by Drupal 7. It's in "Prv/manufaktura".
hasło SpicyHotdog podobno
If you provide any changes to settings.php regarding config split make sure you clear your cache to make it work.
Config split also comes with its config file eg.: config_split.config_split.pl_dev.yml
This file should also be part of general config stored in profile, that's the only one site specific setting that resides in profile config.
To export split config make sure it's active (settings.php has a info that enables it and cache is cleared). Once it's done:
drush config-split:export (This will update both config and pl_dev).
While installing profile from current config split configuration is also applied by default.
lando drush si ck --account-pass=admin
or
lando drush si --account-pass=admin (if distriburion is set in profile yml file).
Drupal 8 from 8.6 version allows to install profile with exported configuration. To do this you need to:
in settings.php specify the path to your config dir. Of course config files needs to exist in order to import it on profile install. So let's assume we're gonna keep our config files in profile directory, as it's part of the installation process:
$config_directories['sync'] = $app_root . '/profiles/custom/ck/config/sync';
The next thing is to edit core.extension.yml file. As we assume that config was exported from different installation profile (eg. standard), (and the profile name is part of that file) we need to tweak it, so it contains our new name of profile. There are two places where we need to tweak it, in module list - the last item with weight 1000 and profile name in profile section, something like this:
module:
.
.
.
dblog: 0
menu_link_content: 1
views: 10
ck: 1000
theme:
stable: 0
classy: 0
seven: 0
profile: ck
_core:
default_config_hash: R4IF-ClDHXxblLcG0L7MgsLvfBIMAvi_skumNFQwkDc
Once we have these two things done we can install drupal with custom profile.
That kind of installation cannot have hook_install function implemented. This hook is triggered before config import so all the changes would be overriden (or not :). However there are features which can be provided in hook_install and adds functionalities that config files does not allow. Anyway, there is a way to provide something similar which is: hook_install_tasks, the implementation can be found here and it works as I tried it with logger:
https://www.drupal.org/project/drupal/issues/2982052#comment-13044759
Another issue regarding to this documentation (https://www.drupal.org/node/2897299) is that there are two ways of providing config dir. In my case I had to provide a $config_directories in settings.php in order to profile trigger config and import it during installation.
In general installing a drupal from exported configuration is a feature that existed as a separate module/profile thing: https://www.drupal.org/project/config_installer
But as it was part of installation process drupal guys decided to make it part of drupal core.
Last thing to note is the uuid value. This is the value of drupal website after installation. It turns out there's no way to import config files to a site B from site A if UUID is different. This value is generated during drupal installation, unless we deliver this value. The value is storred in system.site.yml config file. So, this file has to be part of config we use during drupal profile install process.
Part config is managed by config_split module. Watch this part: https://youtu.be/x2kYZhgUSU0?t=683
or
take a look at this: https://www.drupal.org/docs/8/modules/configuration-split/creating-a-simple-split-configuration-dev-modules-only-in-dev
or look at notes in this document, a section above.
Custom modules are mixed with contrib modules, no profile, no standards provided. List of custom modules:
- ajax_catcher
- circlek_cannonical
Theme:
circlek
Store locator is using mapboxgl plugin. Endpoint is set to "/stores_new.php" whatever this is. There's no such file in root dir or anywhere in the code.
Basic module (bricks) provides a bricks field only.
Bricks Inline provides a (manage form display) to change type of referencing to use inline forms. However inline form comes from inline_entity_form module.
Solros - system rezerwacji samochodow na .se napisany jako plugin do Oracle web cos tam.
Pawel Haran bedzie odpowiedzialny za nowy branding Ingo.
dawna@statoilfuelretail.com
dawid.nawrot@circlekeurope.com
RxLa57YRTell me Future Boy...
Dominika Trafiał - zajmuje się koordynacją prac utrzymaniowych systemow juz na produkcji
Ubuntu:
user: dnawrot
pwd: same as mac
Installed witout any issues with these instructions: https://docs.microsoft.com/pl-pl/windows/wsl/install-win10
Available at: http://localhost:6688/
Ports config at: /etc/apache2/ports.conf
General config at: /etc/apache2/apache2.conf
Commands: sudo service apache2 reload / start / stop / status
CircleK.com - projekt realizowany przez firme, ktorej developerzy pochodza z Ostrawy. W tej chwili czesc skomplikowanych blokow jest zaprojektowana przez developerow i wrzucona bezposrednio w wysiwyg jako html. Jakakolwiek zmiana wprowadzona przez osoby od tresci konczy sie rozsypaniem elementu.
Projekt europejski - obejmuje 13 krajów i ma byc stworzony na podstawie circlek.com. CircleK.com ma byc wylacznie referencja, ale nie kopia. Calego drupala konfigurujemy od zera, ale moze byc wykorzystana skorka. Osoba odpowiedzialna (pm) jest Robert O ze szwecji, a w pozniejszym czasie ma zostac product ownerem. Będzie od poczatku hostowany na aws.
Ingo - projekt dotyczacy tanich stacji bezobslugowych w Szwecji. Ma to byc white label dla projektu europejskiego podstawowego. Czyli generalnie ladujemy dodatkowy css po wszystkich nadpisujacy glowny theme. Z reszta, w tej chwili strona https://www.ingo.se/ jest dokladnie tak zrobiona, czyli struktura jest identyczna jak https://www.circlek.se/sv_SE roznica polega jedynie na kolorach i brandingu. Za ten projekt tez odpowiada Robert O. To jest czesc projektu europejskiego.
innerCircle - global intranet - stworzone przez firme Opin z Kanady. Hostowane na acquia.com, ale w pozniejszym czasie ma byc przeniesione do aws. Przy instalacji / byl problem z konfiguracja mysql, dane nie mogly byc zaimportowane. Nalezalo zmienic wartosc w ustawieniu innodb_log_file_size z 32MB na 128MB. Plik konfiguracyjny dla mysql dostarczonego z DevDesktop (Acquia) mozna znalezc w Program Files (x86)/DevDesktop/mysql/my.cnf
WiFi:
ck-visitor
FreshFood123
RY75aLxRTell me Future Boy...
Run drush in drupal /web dir: ../vendor/drush/drush/drush cr
PHP local location: c:\php-7.2.18
php.ini location: c:\php-7.2.18\php.ini
OpCache is part of Windons PHP distribution, but it's not listed in php.ini. This extension is recommended by d8, so in order to load it we need to add:
zend_extension=php_opcache.dll
at the end of extensions and set it to 1 down where each plugin is configured:
opcache.enable=1
Apache location: c:\Apache24
Executive apache: c:\Apache24\bin
Config: c:\Apache24\conf\httpd.conf
Apache is running as a windows service and it's been added to PATH, so:
running it up (by default it's auto enabled): httpd -k start
stopping it: httpd -k stop
restart: httpd -k restart
To make clean urls working I had to change:
AllowOverride none
to
AllowOverride All
but make sure you're doing it in the right place, becasue there are several occurences of this setting. So, in my case it was:
DocumentRoot "${SRVROOT}/htdocs"
AllowOverride All
MySQL is running as a service and it's been added to PATH:
mysql -u root -p
Restart service:
Win + R: services.msc
MySQL80 refresh
Config file: C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
MySQL 8 however comes with default_authentication_plugin setting set to caching_sh2_password value, which does not allow PHP to connet to mysql client. In order to make it usable we need to change it to: mysql_native_password value. After that we need to create new user and grant permissions and new database, like so:
CREATE USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
CREATE DATABASE 'db_name';
Default username used for sites is: admin, password is admin.
UPDATE 20.11.2019
Another instance of MySQL has been installed. It's 5.7 and it's running independently next to version 8. It's been installed with community installer. With this msi file you can install as many MySQL instances as you want, the only thing you need to change is the port the mysql service is running. So, currently there are two instances of mySQL running locally as a service, on is MySQL80 and second one is MySQL57. MySQL80 is running on 3306 port and MySQL57 is running on 3308 port. Access to 57 version is root and password is root. You can run console tool by executing: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MySQL\MySQL Server 5.7\MySQL 5.7 Command Line Client shortcut. Log in to db by providing root password. There should be drupal8 db. I installed drupal8 (provided by apache) in this DB. So, currently if you want you can switch DB's by adjusting settings.php in C:\Apache24\htdocs\d8\web\sites\default\settings.php. Here are the settings to connect to MySQL80:
$databases['default']['default'] = array (
'database' => 'drupal',
'username' => 'admin',
'password' => 'admin',
'prefix' => '',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
Here are the credentials to connect to MySQL57:
$databases['default']['default'] = array (
'database' => 'drupal8',
'username' => 'root',
'password' => 'root',
'prefix' => '',
'host' => 'localhost',
'port' => '3308',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
AWS docker containers
docker run -p 8181:80 --env MYSQL_DATABASE=docker_test1 --env MYSQL_USER=admin --env MYSQL_PASSWORD=admin --env MYSQL_HOSTNAME=192.168.1.74 --env MYSQL_PORT=3308 --env WORKING_ENVIRONMENT=test --env SITE_CODE=pl --env HASH_SALT=5TerGYk6Po7NtPGBzYYMHJ8MjgOP7GeJLNEgHPn-CZgXuSYMUBYaNgesNsr48zEYDKC7Hhke4w cksites:test12
Dan Peckardt sent creds:
Username: DNawrot@circlek.com || TOSCO\DNawrotPassword: Hello@DN0826
Importing string translations during drupal installation
First of all you have to have your language exported to files. Next thing is to set the path where translations are stored. This can be done at: admin/config/media/file-systemRight after that go to: admin/config/regional/translate/settings and set "Source translations" to "Only local files". Then export this config and install drupal. There are several ways to import translation during installtion, but none of these worked for me. There always has been an issue with it. I found somewhere in install.core.inc file that default location of translation files is /files/translations but it didn't work for some reason. Placing translations in profile dir also didn't work. The only one setting that worked was to set up the path in file system. I suppose this might be involved with install from config. This needs to be part of config to make it work. Drupal treats "install from config" process as it has everything you need, so if this path is not set it's not gonna work. I also tried to override this path with:
$config['locale.settings']['translation']['path'] = $app_root . '/sites/default/files/translations';
but it also didn't work.
Manufaktura
Manufaktura was enabled on Lando due to issue with MySQL8 which is not supported by Drupal 7. It's in "Prv/manufaktura".
Screen recording - Windows
Go to IE and check favorites. There's a link to https://www.apowersoft.com/free-online-screen-recorder?__c=1 just start recording. In the panel that appears on the microphone icon set system sound and microphone and also make it full screen, then REC.Siec Avengers
szukaj w firmie wifi Avengershasło SpicyHotdog podobno
Split configuration
Config specific to country / env should be placed at site repository, eg. config/pl_dev.If you provide any changes to settings.php regarding config split make sure you clear your cache to make it work.
Config split also comes with its config file eg.: config_split.config_split.pl_dev.yml
This file should also be part of general config stored in profile, that's the only one site specific setting that resides in profile config.
To export split config make sure it's active (settings.php has a info that enables it and cache is cleared). Once it's done:
drush config-split:export (This will update both config and pl_dev).
While installing profile from current config split configuration is also applied by default.
Profile install
Command:lando drush si ck --account-pass=admin
or
lando drush si --account-pass=admin (if distriburion is set in profile yml file).
Drupal 8 from 8.6 version allows to install profile with exported configuration. To do this you need to:
in settings.php specify the path to your config dir. Of course config files needs to exist in order to import it on profile install. So let's assume we're gonna keep our config files in profile directory, as it's part of the installation process:
$config_directories['sync'] = $app_root . '/profiles/custom/ck/config/sync';
The next thing is to edit core.extension.yml file. As we assume that config was exported from different installation profile (eg. standard), (and the profile name is part of that file) we need to tweak it, so it contains our new name of profile. There are two places where we need to tweak it, in module list - the last item with weight 1000 and profile name in profile section, something like this:
module:
.
.
.
dblog: 0
menu_link_content: 1
views: 10
ck: 1000
theme:
stable: 0
classy: 0
seven: 0
profile: ck
_core:
default_config_hash: R4IF-ClDHXxblLcG0L7MgsLvfBIMAvi_skumNFQwkDc
Once we have these two things done we can install drupal with custom profile.
That kind of installation cannot have hook_install function implemented. This hook is triggered before config import so all the changes would be overriden (or not :). However there are features which can be provided in hook_install and adds functionalities that config files does not allow. Anyway, there is a way to provide something similar which is: hook_install_tasks, the implementation can be found here and it works as I tried it with logger:
https://www.drupal.org/project/drupal/issues/2982052#comment-13044759
Another issue regarding to this documentation (https://www.drupal.org/node/2897299) is that there are two ways of providing config dir. In my case I had to provide a $config_directories in settings.php in order to profile trigger config and import it during installation.
In general installing a drupal from exported configuration is a feature that existed as a separate module/profile thing: https://www.drupal.org/project/config_installer
But as it was part of installation process drupal guys decided to make it part of drupal core.
Last thing to note is the uuid value. This is the value of drupal website after installation. It turns out there's no way to import config files to a site B from site A if UUID is different. This value is generated during drupal installation, unless we deliver this value. The value is storred in system.site.yml config file. So, this file has to be part of config we use during drupal profile install process.
Far beyond, another thing is importing part of config. This might be useful to make local changes (per country). To import part of config we can do it with drush like so:
drush config-import --partial --source=config/pl
Works similar to features-revert. Here is nice video explanation: https://www.youtube.com/watch?time_continue=2&v=x2kYZhgUSU0
drush config-import --partial --source=config/pl
Works similar to features-revert. Here is nice video explanation: https://www.youtube.com/watch?time_continue=2&v=x2kYZhgUSU0
Part config is managed by config_split module. Watch this part: https://youtu.be/x2kYZhgUSU0?t=683
or
take a look at this: https://www.drupal.org/docs/8/modules/configuration-split/creating-a-simple-split-configuration-dev-modules-only-in-dev
or look at notes in this document, a section above.
CircleK.com, business-centre-europe.circlek.com
Initial investigation:Custom modules are mixed with contrib modules, no profile, no standards provided. List of custom modules:
- ajax_catcher
- circlek_cannonical
Theme:
circlek
Store locator is using mapboxgl plugin. Endpoint is set to "/stores_new.php" whatever this is. There's no such file in root dir or anywhere in the code.
Bricks
Basic module (bricks) provides a bricks field only.
Bricks Inline provides a (manage form display) to change type of referencing to use inline forms. However inline form comes from inline_entity_form module.
Solros - system rezerwacji samochodow na .se napisany jako plugin do Oracle web cos tam.
Pawel Haran bedzie odpowiedzialny za nowy branding Ingo.
dawna@statoilfuelretail.com
dawid.nawrot@circlekeurope.com
Dominika Trafiał - zajmuje się koordynacją prac utrzymaniowych systemow juz na produkcji
Ubuntu:
user: dnawrot
pwd: same as mac
Installed witout any issues with these instructions: https://docs.microsoft.com/pl-pl/windows/wsl/install-win10
Available at: http://localhost:6688/
Ports config at: /etc/apache2/ports.conf
General config at: /etc/apache2/apache2.conf
Commands: sudo service apache2 reload / start / stop / status
CircleK.com - projekt realizowany przez firme, ktorej developerzy pochodza z Ostrawy. W tej chwili czesc skomplikowanych blokow jest zaprojektowana przez developerow i wrzucona bezposrednio w wysiwyg jako html. Jakakolwiek zmiana wprowadzona przez osoby od tresci konczy sie rozsypaniem elementu.
Projekt europejski - obejmuje 13 krajów i ma byc stworzony na podstawie circlek.com. CircleK.com ma byc wylacznie referencja, ale nie kopia. Calego drupala konfigurujemy od zera, ale moze byc wykorzystana skorka. Osoba odpowiedzialna (pm) jest Robert O ze szwecji, a w pozniejszym czasie ma zostac product ownerem. Będzie od poczatku hostowany na aws.
Ingo - projekt dotyczacy tanich stacji bezobslugowych w Szwecji. Ma to byc white label dla projektu europejskiego podstawowego. Czyli generalnie ladujemy dodatkowy css po wszystkich nadpisujacy glowny theme. Z reszta, w tej chwili strona https://www.ingo.se/ jest dokladnie tak zrobiona, czyli struktura jest identyczna jak https://www.circlek.se/sv_SE roznica polega jedynie na kolorach i brandingu. Za ten projekt tez odpowiada Robert O. To jest czesc projektu europejskiego.
innerCircle - global intranet - stworzone przez firme Opin z Kanady. Hostowane na acquia.com, ale w pozniejszym czasie ma byc przeniesione do aws. Przy instalacji / byl problem z konfiguracja mysql, dane nie mogly byc zaimportowane. Nalezalo zmienic wartosc w ustawieniu innodb_log_file_size z 32MB na 128MB. Plik konfiguracyjny dla mysql dostarczonego z DevDesktop (Acquia) mozna znalezc w Program Files (x86)/DevDesktop/mysql/my.cnf
WiFi:
ck-visitor
FreshFood123
Local setup
Run drush in drupal /web dir: ../vendor/drush/drush/drush cr
PHP local location: c:\php-7.2.18
php.ini location: c:\php-7.2.18\php.ini
OpCache is part of Windons PHP distribution, but it's not listed in php.ini. This extension is recommended by d8, so in order to load it we need to add:
zend_extension=php_opcache.dll
at the end of extensions and set it to 1 down where each plugin is configured:
opcache.enable=1
Apache location: c:\Apache24
Executive apache: c:\Apache24\bin
Config: c:\Apache24\conf\httpd.conf
Apache is running as a windows service and it's been added to PATH, so:
running it up (by default it's auto enabled): httpd -k start
stopping it: httpd -k stop
restart: httpd -k restart
To make clean urls working I had to change:
AllowOverride none
to
AllowOverride All
but make sure you're doing it in the right place, becasue there are several occurences of this setting. So, in my case it was:
DocumentRoot "${SRVROOT}/htdocs"
AllowOverride All
MySQL is running as a service and it's been added to PATH:
mysql -u root -p
Restart service:
Win + R: services.msc
MySQL80 refresh
Config file: C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
MySQL 8 however comes with default_authentication_plugin setting set to caching_sh2_password value, which does not allow PHP to connet to mysql client. In order to make it usable we need to change it to: mysql_native_password value. After that we need to create new user and grant permissions and new database, like so:
CREATE USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
CREATE DATABASE 'db_name';
Default username used for sites is: admin, password is admin.
UPDATE 20.11.2019
Another instance of MySQL has been installed. It's 5.7 and it's running independently next to version 8. It's been installed with community installer. With this msi file you can install as many MySQL instances as you want, the only thing you need to change is the port the mysql service is running. So, currently there are two instances of mySQL running locally as a service, on is MySQL80 and second one is MySQL57. MySQL80 is running on 3306 port and MySQL57 is running on 3308 port. Access to 57 version is root and password is root. You can run console tool by executing: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MySQL\MySQL Server 5.7\MySQL 5.7 Command Line Client shortcut. Log in to db by providing root password. There should be drupal8 db. I installed drupal8 (provided by apache) in this DB. So, currently if you want you can switch DB's by adjusting settings.php in C:\Apache24\htdocs\d8\web\sites\default\settings.php. Here are the settings to connect to MySQL80:
$databases['default']['default'] = array (
'database' => 'drupal',
'username' => 'admin',
'password' => 'admin',
'prefix' => '',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
Here are the credentials to connect to MySQL57:
$databases['default']['default'] = array (
'database' => 'drupal8',
'username' => 'root',
'password' => 'root',
'prefix' => '',
'host' => 'localhost',
'port' => '3308',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
AWS docker containers
docker run -p 8181:80 --env MYSQL_DATABASE=docker_test1 --env MYSQL_USER=admin --env MYSQL_PASSWORD=admin --env MYSQL_HOSTNAME=192.168.1.74 --env MYSQL_PORT=3308 --env WORKING_ENVIRONMENT=test --env SITE_CODE=pl --env HASH_SALT=5TerGYk6Po7NtPGBzYYMHJ8MjgOP7GeJLNEgHPn-CZgXuSYMUBYaNgesNsr48zEYDKC7Hhke4w cksites:test12
Tuesday, 12 June 2018
Docker
Laradock
To run fotobudka environment: docker-compose up -d mysql nginx
To stop fotobudka environment: docker-compose stop
Installation:
With default configuration docker is going to crash due to running apache on Mac on port 80. We need to change port for nginx in laradock/.env file to any other then 80, might be 8080. So it goes like this:
I had another issue with starting nginx becasue of 443 port allocation. When typed docker ps it showed fucking traefik:1.3-alpine that runs on 443 port. So I stopped it with docker stop container_id. Then I all worked.
To run fotobudka environment: docker-compose up -d mysql nginx
To stop fotobudka environment: docker-compose stop
Installation:
With default configuration docker is going to crash due to running apache on Mac on port 80. We need to change port for nginx in laradock/.env file to any other then 80, might be 8080. So it goes like this:
NGINX_HOST_HTTP_PORT=8080
Also we can change it for apache in case we want to use it:
APACHE_HOST_HTTP_PORT=8080
Another thing is the configuration of nginx. Laradock comes with several default configuration files for nginx depends on framework you want to run. I don't really know how to force it to use the one I want, so I just provided one tiny change in default.conf and changed this:
root /var/www/public;
into this:
root /var/www/public_html;
because for fotobudka public code is in public_html directory, as it's a default public directory on mydevil.net.
Login to SSH: docker-compose exec workspace bash
Login to SSH: docker-compose exec workspace bash
Monday, 22 January 2018
D8
drupalvm
Uruchamianie i zamykanie
make upmake stop
Docker
Import bazy:1. Logowanie do mariadb przez portainer
2. Wrzucić dump z mariadb-init do mariadb-manual
3. Dump po zalogowaniu do containera powinien byc dostepny w /var/lib/mysql/dumps
4. Import bazy drupal/drupal/drupal (najpierw drop database, potem create, potem import, potem drush cr w php container).
Free up local storage
With each drupalvm instance setup (by set up I mean git clone of drupalvm and vagrant up) it's downloading new base box image. These images are kept in VirtualBox VM's folder in separated directories like:
packer-ubuntu-16.04-amd64_2232343245445_23344/packer-ubuntu-16.04-amd64-disk001.vmdk
packer-ubuntu-16.04-amd64_3343354343455_33224/packer-ubuntu-16.04-amd64-disk001.vmdk
packer-ubuntu-16.04-amd64_2323434243223_56566/packer-ubuntu-16.04-amd64-disk001.vmdk
etc.
The image that is downloaded is treated as base image to set up your environment based on your settings in yaml file. While vagrant up is running it copies this image into the separate folder with the name of your project eg. drupalvm.dev and installs all the required packages listed in yaml file. However when vagrant up is completed the base file stays in packer-ubuntu-16.04-amd64_2232343245445_23344 directory. And it's not used anymore because new one was generated for you based on this one. This file takes almost 2GB of data. And you can easily delete this file.
Directory structure (let's assume that VirtualBox VMs folder stores all the boxes):
Before any vagrant build it's empty:
/VirtualBox VMs
.
..
After gitclone and vagrant up (in completely separated directory, code of your site and drupalvm code from github has nothing to do with directories below). Assume your projects name is 'drupal':
/VirtualBox VMs
.
..
drupal/
packer-ubuntu-16.04-amd64_2232343245445_23344/
In this case you can delete this folder packer-ubuntu-16.04-amd64_2232343245445_23344/
IMPORTANT UPDATE
It seems like last setup I made has changed. I cloned drupalvm and run vagrant up. After the build base box image located in one of this: packer-ubuntu-16.04-amd64_2323434243223_56566/packer-ubuntu-16.04-amd64-disk001.vmdk is used to run the environment, so it looks like drupalvm no longer copies this file into your projects directory and makes changes on it. I don't really know how it works right now, but there are two possibilities:
1. It makes changes directly into packer-ubuntu-16.04-amd64_2323434243223_56566/packer-ubuntu-16.04-amd64-disk001.vmdk file so it reflects your yaml config.
2. It does not change packer-ubuntu-16.04-amd64_2323434243223_56566/packer-ubuntu-16.04-amd64-disk001.vmdk at all but all the dependencies are located in your project VM directory. This approach is rather not possible, it's really hard to imagine that it changed so much that dependencies are separated into another folder.
Hoteltreats
Sass
This command should be run in main theme directory from main system (not VM):sass --watch scss/style.scss:css/style.css
Konfiguracja danej domeny/strony
Znajduje się w hoteltreats/private/hotel-x.hoteltreats.test.ymlWszystkie zmienne znajdujące się w hotelstyles.settings są również opisane w themes/hotelstyles/config/schema/hotelstyles.schema.yml
Logowanie
drush uliZarzadzanie Treats
Structure -> TreatsForm: Property -> Le Meridian, published, english
Edit any node -> Micorsie Tab -> In collections field (eg. Best Experiences)
Nadpisywanie zmiennych
1. W pierwszej kolejności zmienne SASS deklarujemy w _default-variables.scss2. Następnie wpisujemy tą zmienną w _css-vars.scss
3. Następnie używamy jej w plikach w /components jako mixin var (tutaj nie jest deklarowana zmienna, a wywolywana juz wczesniej zdeklarowana w :root)
4. Jesli ostatecznie chcemy nadpisac ta zmienna uzywamy jej w /private/microsites/something.yml
Thursday, 4 January 2018
NodeJS - BC
Auth0
Go to: https://publisher-film.beacon.britishcouncil.digital
Log in with credentials:
dawid.nawrot@britishcouncil.pl
dmj2=DGZVXAChRzh6sk*hkuXd8KHR=ecEZrT)7tVaijLEvHxbtu4pp=zGLwrFQYW
Enable 2 factor auth if needed.
After logging in go to console and get access_token by typing:
localStorage.access_token
in console. It should return access token.
Go to playground and add code to add a page and in http headers add authorization header like so:
{
"Authorization" :"Bearer access_token"
}
it should return an ID of a page.
You can also go to https://jwt.io/
and paste your access_token to get an idea what you can do in scope section and how long this access_token is valid.
Adding a page with test:seed and publishing with graphql playground
Once panda is running go to console and type:lando yarn test:seed
This is going to create a full page for you bypassing authorization. A structure of a page can be viewed at panda/src/resolvers/__tests__/helpers/data.js (fullSamplePage constance).
Once the page is added, you can log in to mongo db and get pageId value. Copy pageId and go to playground to publish it.
Postgraphile:
Video
Starting the app. First you need to have yarn installed and node > 8.6. I use nvm, so to install another version of node i use:
nvm install 8.9
Check node version with:
nvm version node
With this we can go to /zoo/hedgehog and type yarn which will install project which will display:
dns-MacBook-Pro-2:hedgehog dn$ yarn start
yarn run v1.10.1
warning ../package.json: No license field
$ env NODE_ENV=production node src/index.js
> 🐻 is alive and kicking at:
>> http://localhost:5000/graphql (Apollo)
>> http://localhost:5000/db (PostGraphile)
Several things needs to be done to make this work now. The problem is that postgresql does not have any schema imported and no data. If you try to run yarn seed it will end up with error. So, we need to:
1. Log in to lando service where PostgresDB exists
lando ssh pg
2. Import schema to db
psql -f src/postgres/schema.sql -U hh hh
In result we should get:
CREATE TYPE
CREATE TYPE
CREATE TABLE
CREATE TABLE
3. Log in to db to verify if schema exists.
psql -d hh -U hh
Similar to show databases in MySQL is:
\dt
Which should result with List of relations
Schema | Name | Type | Owner
--------+----------+-------+-------
public | author | table | hh
public | metadata | table | hh
(2 rows)
To exit from db:
\q
4. Edit seed.js file to uncomment part which adds users and comment out part which adds metadata.
5. RUN yarn start
5. In another console tab run yarn seed to generate users.
6. Edit seed.js file to comment out users and uncomment metadata.
7. Run yarn seed again to generate metadata.
8. Go to ChromiQL and provide backend url to db (http://localhost:5000/db)
9. Check if schema is there.
10. Go to Apollo graphql endpoint and run example query or mutation.
Easy, right?
Apollo graphql endpoint usage:
Query and mutation:
Connecting to DB issue
Whenever you get an error about port allocated for database the issue is that you run wrong command or use wrong direcotory for command. Scenarios:1. If you decide to run all the apps (Panda, Rhino, Puma) at the same time with lando start from /zoo direcotory you need to run commands from /zoo direcotory. For example:
lando panda test:watch
lando panda user:add --username='admin' --password='admin' --email='admin@example.com'
and so on.
2. If you have three apps at once, but you run only one at the time, eg.: lando start panda then commands should be quite different. First of all all the commands should be run from panda directory. For example:
lando yarn test:watch
lando yarn user:add --username='admin' --password='admin' --email='admin@example.com'
And that's it.
Working with panda on platform.sh
Login to ssh with platform.sh on desired branchfrom /app directory we run:
yarn user:add --username='dawidnawrot' --password='dawidnawrot' --email='dawidnawrot@example.com'
yarn user:role --username='dawidnawrot' --role='admin'
voilla
Document describing project
DocumentUpdating libraries
If someone updates package.json file, so it has new dependencies (dev or standard) we need to get those to make project work. So, assuming we already have pulled changes with new dependencies we need to type:lando panda add mongoid-js@1.1.3 --dev
This example shows how to add mongoid, which was added by someone else to package.json. I'm pretty sure it might be done better way, so we don't have to list dependency, there should be some update command.
Update: and there is: lando yarn upgrade (note it's upgrade, not update)
As far as the command itself:
lando - run lando
panda - use panda project
add - this is one of yarn commands, so if this was provided without lando we would type: yarn add mongoid-js@1.1.3 --dev but I assume lando is configured the way we don't have to use yarn command because it's a default one.
mongoid-js@1.1.3 - it's a package and version of it
--dev - it's the same as --save-dev in npm
Cheetsheet for yarn vs npm commands: https://github.com/areai51/yarn-cheatsheet
Running tests against panda
Assuming we're working in consolidated version of zoo:
1. We run tests from /zoo directory (not from panda)
2. In /zoo directory we can run:
lando panda test
lando panda test:watch
And so on. So all the scripts that are defined in panda/package.json are run from /zoo directory but with
lando pandaprefix.
In addition, because we use yarn, rather npm for running test commands we don't have to add
runfor non default scripts. So, if were using npm it should be something like this:
lando panda npm run test:watch
But, becasue we use yarn and it's already aliased, we run:
lando panda test:watch
As we run tests we need to have some users. Tests that run mostly defines some users (eg. a username or password or role). So, we need to generate those users or roles in order to pass tests. To add user or role we can use scripts developed by Simon. It's described down below, in next section.
And that's it.
Adding a page from scratch
1. Go to /zoo directory
2. We have to create a user if there's no users in DB:
lando panda user:add --username='admin' --password='admin' --email='admin@example.com'
It should give us a note in green: "User added".
3. We have to assign a role to this user. Available roles are: guest, contributor, editor, admin, superadmin. It's all from in db.acl_roles.find() collection.
To assign a user to specific role:
lando panda user:role --username='admin' --role='superuser'
It should give us a note in green: "Role added to admin".
4. Open up a ChromeiQL extension. Endpoint should be set up to: http://panda.lndo.site/graphql
5. Write a login mutation to login:
mutation login {
login(username:"admin", password:"admin") {
username
id
}
}
6. To check if we're logged in query DB:
query currentUser {
currentUser {
id,
email,
username
}
}
7. To add a page we need to use two window sections, first we provide a mutation and second we add query variables like so:
Mutation:
mutation addPage($input : PageInput) {
addPage(input : $input)
{
id
}
}
Query variables:
{
"input": {
"language": "pl",
"type": "whatever"
}
}
By running this mutation with those variables we should end up with that kind of response:
{
"data": {
"addPage": {
"id": "5b4734f38dbeba047107ee29"
}
}
}
Using scripts made with babel-node
Being in zoo direcotory (not panda) type:lando panda user:add --username='admin' --password='admin' --email='admin@example.com'
General note
It's better to use chromeIQL extension rather than Playground Tool. The second one is buggy, it does not send a cookie, so there's no way to find out whether user is logged in or not.Adding user:
Simplest query:
Current user:
Multiple queries
You can choose the one you want on play. Basically it just needs a name right after the query or mutuation:Basic facts about node
- npm = bower (2013) = yarn (2017)
- to start new project we use npm init which generate package.json file
- npm init command will only generate package.json file, it's not checking anything (if the index.js file exists, or similar
- npm is using package.json file to keep project dependencies
- npm is a package manager, so you don't have to download each library, but declare it in package.json file
- Installing package: npm install package_name --save or npm install package_name --save-dev. This will do two things, first it'll modify package.json file. Second it'll download a package to node_modules folder.
- If you have node.js installed, you already have npm installed
Node.js -> Webpack and require function
Loading external files: php have its include() function. Javascript didn't have this feature until a new project CommonJS started in 2009. The output of this project is node.js which is server software and it does allow to do this. Previously all the files had to be loaded each by each in html. Today we can use something like that with nodejs. Instead of loading all of moment.min.js with an HTML script tag, you can load it directly in the JavaScript file as follows:
This is how module loading works in node.js, which works great since node.js is a server side language with access to the computer’s file system. Node.js also knows the location of each npm module path, so instead of having to write require('./node_modules/moment/min/moment.min.js), you can simply write require('moment') — pretty sweet.
Ok, but this won't work right now, as browser does not know what is require function. To make it work we need to have module bundler, which will make an output as one big file, for example bundle.js with all libraries in it. The bundler we need is a Webpack.
Installing webpack:
Running webpack:
This is going to analyze index.js file, it'll find all the occurences of require and replace it with actuall js files and output it as a bundle.js file. It's all working fine, but with any change in index.js file we would have to run it over and over again. To automate this process we have to create webpack.config.js file in root directory of our project.
This will allow us to regenrate everythis with simpler version:
To make it work even easier we can run task runner that comes with npm. We can do it by modifying package.json file like so:
Running npm run build will rebuild everything and will minimize our code for production because it uses -p option.
Running npm run watch will rebuild everything on the fly with every change to index.js file.
Let's go deeper and run a tool (webpack-server-dev) that will automatically refresh our site in browser with every change we make in index.js file.
Now, we have to add another script / command to our package.json file to make it work:
Mongo CLI
- To open mongo db cli just type: lando mongo in project directory
- To login to main: lando mongo main -umain -pmain
Commands
- db.getCollectionNames() - displays list of collections
- db.[collectionName].find() - similar to select * from collectionName
- db.contents.find().pretty()
- db.users.find().pretty()
- db.roles.find().pretty()
- db.components.find(ObjectId("5b55bad212161c05e9fa5e2c")).pretty()
- db.components.find({}, {}).pretty() - get IDs only
- db.components.find({ col1: "A" }, { column, column, column }) - similar to: select col1, col2 from components where col1 = A
Lando
- lando logs -t -f
- lando start
- lando stop
- lando restart
- lando rebuild
Useful links
Link to testing branch for PR (different then with drupal)
Quote from Vin: "when a PR is open, go to the PR, scroll down, open up "checks passed", next to platformsh, details link".
Thursday, 8 June 2017
English phrases
- gaslighted - eg. He was gaslighted - czyli ktoś nim manipulował, np. przedstawiał wersję nieprawdziwą i wmawiał, że tak było. To jest termin psychologiczny.
- framing someone for something - wrabiać kogoś w coś (przerzucić winę na kogoś w sprawie jakiegoś przestępstwa)
decay
rozkładkingpins
- szpilki (mozna tak powiedziec o kims waznym, o kims w srodku). He is a kingpin of art.strive
starac się, walczyćThe blood bank must continuously strive to maintain supply as 1.2 million people across the country have never given blood.
loo
toiletEither that or...
albo to (cokolwiek), albo..
climb down out of my ass
zejdz ze mnie
turf
terytorium w kontekscie twojego ogrodka, dzialki, domu, stanowiska pracy czegos nad czym masz kontrolę.
Np.: You better watch your turf. - Lepiej pilnuj swojego terytorium.
sufficiently
dostatecznie, wystarczająco dobrze
sufficient
wystarczającyscribble
bazgrać
np.: They attempted to engage Anthony in conversation. - Postarali się aby zaangazowac Anthonego w dyskusję.
engage
angazowac sięnp.: They attempted to engage Anthony in conversation. - Postarali się aby zaangazowac Anthonego w dyskusję.
attempt
probowac, usilowac, postarac sieThey made no attempt to escape. (Oni nie podjęli próby ucieczki.)
Soon he gave up the attempt. (Wkrótce on porzucił próbę.)
The reason for his imprisonment was his attempt to rape somebody. (Powodem jego uwięzienia była jego usiłowanie zgwałcenia kogoś.)
slapping
policzkowactiara
koronabaffling
zaskakującypeeps
peoplefirecracker
petardalabor
praca (głównie umysłowa)on the lark
dla zabawynp. I bought this old car on the lark. Kupiłem ten samochod dla zabawy (zeby go wykonczyc).
slit my wrists
poderżnąć sobie żyłyprofitable
opłacalny, np. this mortage is more profitable the the other one.distracted
rozkojarzonyremedy
złoty środek, np. It's a remedy for your problem. To jest złoty środek na twój problem. Generalnie chodzi o rzeczownik w sensie jakiegoś radzenia sobie z problemem.elephantine (wym. elefantajn)
duży, ogromnyamend
modyfikować, poprawiać, zmieniać,np. This is the slightly amended text of an address he gave.
To jest trochę zmieniony adres, który Ci dał.
assumption
założenie, hipotezavigilant
czujnyrestrain
ograniczac, hamowac,intimidate
zastraszactentative
wstępny, np. tentative datesanitize
czysty, make clean and hygenic, sterilizerefine
oczyscic, uszlachetnicballpark
przybliżony zakres, przyblizony czas, przyblizony kosztelusive
nieuchwytnyinconvenience
niedogodnosc
Subscribe to:
Posts (Atom)




