Giter Club home page Giter Club logo

summerhouse's Introduction

summerhouse_main_image

Welcome to Summer House

Welcome to Summer House, a fully-dockerized environment for onboarding processes based in Decoupled / Headless Drupal.



1. What is Summer House

Summer House is a sandbox for Drupal Decoupled projects, generating boilerplate code, built for training purposes and focused on learning-by-doing. The project is self-contained and host environment agnostic. This project deploys a whole Decoupled Drupal platform on-the-fly with a lot of extra-resources, tools and configurations, but only for local development. You can use Summer House for Onboarding processes, workshops and training sessions. Or just for fun.

2. Pre-requisites

You can use SummerHouse in Linux environments and specifically in Debian / Ubuntu. SummerHouse requires the next resources: Git, Docker, Docker-Compose and DDEV.

If you don't have the prerequisites installed in your host system you can install the resources from a installer script created and committed to the repository. The installer script is here.

Just download the script in your system, give it permissions and execute the installer. This will install Docker, Docker-Compose and DDEV in your Linux system (Ubuntu, Debian). Also it will install some basic resources like git, jq, curl and basic packages.

$ chmod +x installing_docker_dockercompose_ddev.sh
$ ./installing_docker_dockercompose_ddev.sh

Note: If you consider that delegate the prerequisites to a script is insecure or may put your environment at risk, here is some information so you can do it by yourself:

3. Install // Uninstall

Installating and deploy

You can install Summer House in just three steps, just by doing:

$ git clone https://github.com/davidjguru/summerhouse.git #Get a local copy.
$ cd summerhouse #Move to the folder.
summerhouse$ ddev start #Run the DDEV build up.

And the project will be loaded, configured, enabled and deployed in your local environment. You will see the main URLs opening in your browser.
Please, remember: Summer House is only for local development. It can contain some configs that can be unsecure in other environments.

You can also download the project from the releases / tags area of the Github repository, selecting the version and downloading the compressed folder. Then you only have to unpack the project and launch DDEV:

$ wget https://github.com/davidjguru/summerhouse/archive/refs/tags/v1.0.0.zip
$ unzip summerhouse-1.0.0.zip
$ cd summerhouse-1.0.0/
summerhouse-1.0.0$ ddev start

And the platform will be mounted and deployed.

Uninstalling and clean up

In order to execute a complete cleaning of your Summer House installation you can do the next steps.

$ cd summerhouse
summerhouse$ yes| ddev delete -O #Delete the DDEV register for Summer House.
summerhouse$ ./scripts/utilities/clean_all_docker_related_resources.sh #Will destroy all docker resources.
summerhouse$ cd ..
$ sudo rm -rf summerhouse #Delete all the codebase. 

4. Addresses // Resources

Summer House will deploy a series of containers from an internal network connected by DDEV with external access from your browser:

5. Troubleshooting

Some common problems have been identified. Check this section for quick interventions.
For more extended information on known bugs and their solutions, visit the related wiki section.

Some ports unavailable

Problems have been detected due to port blocking by other applications. This can cause DDEV start-up problems and lead to others problems during the installation process of the main website, you can get errors just like:

[error]  Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Entities exist of type <em class="placeholder">Shortcut link</em> and <em class="placeholder">Shortcut set</em> <em class="placeholder">Default</em>. These entities need to be deleted before importing. in Drupal\Core\Config\ConfigImporter->validate() (line 750 of /var/www/html/backend_drupal/core/lib/Drupal/Core/Config/ConfigImporter.php).

DDEV operates with ports used by other resources, such as 80 or 443. Check that they are not in use (you do not have Apache running on your system).

Error messages accessing external resources

Summer House obtains a lot of resources through the Internet, so sometimes you can get errors when trying to get external resources:

A MkDocs service file has been located in your system.
fatal: unable to access 'https://github.com/davidjguru/summerhouse.wiki.git/': Could not resolve host: github.com
Task failed: Exec command '([ -d ./mkdocs/docs ] && cd ./mkdocs/docs && git pull origin) || (git clone https://github.com/davidjguru/summerhouse.wiki.git ./mkdocs/docs)'

(We're building up the mkdocs container from a git clone of the repository wiki).

This is the key: Could not resolve host: github.com. You need to check in these cases your assigned DNS servers (or those of your ISP), to ensure that they are functioning normally.

Some errors from commands in macOS

When you're installing Summer House in macOS, some people have reported errors in prompt from some commands execution. Specifically, errors derived from some commands used in the installation process not available in macOS, for instance:

bash: xdg-open: command not found

The equivalent command in macOS would be just open, so you can try to change this command in `.ddev/config.yaml', lines 34 to 38.

And:

Task failed: Exec command 'sed -i '12s/restart: "no"/restart: "on-failure"/' ./.ddev/docker-compose.portainer.yaml' on the host: exit status 1

...When we're altering the restarting policies for the Portainer Container by using the sed command.

Remember, more information on how to deal with more specific errors can be found here:
summerhouse/wiki/troubleshooting.

6. Useful Links

7. Other projects with similar natura

Summer House may not be exactly what you're looking for, but it comes close. If you want to check out other projects that might be closer to your needs, you can try the cases in the following list:

8. Acknowledgments and Thanks

summerhouse's People

Contributors

davidjguru avatar rfay avatar saganakat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

summerhouse's Issues

Hotfix - Change restart policies for Portainer Container

Describe the bug
Now the Portainer Container is always started and working, even if the others containers in the network are stopped. The key always is not the best option for the policies. It must to be changed as hotfix.

[FND] - Create basic scaffolding for a frontend based in ReactJS

For the first MVP version of the project, we need a first initial frontend ready-to-go with the Drupal backend and based in ReactJS.
The goal is build up an internal connection between frontend - backend and getting existing nodes from the frontend, showing a basic list of Drupal Nodes from the React side.

Steps:

  1. Initial scaffolding for a new frontend based in ReactJS.
  2. Enabling of GraphQL server in Drupal backend side, exposing created nodes (10 articles).
  3. Configure GraphQL client in frontend and build requests in order to get the Drupal nodes.
  4. Show the returned Drupal nodes in a list.
  5. Once the connection is made and working, pass the frontend to a Dockerized environment, in a new container / service.

User Story

As developer 
when I want check and testing the basic features of Summer House platform, 
I need an existing connection between frontend and backend for the decoupled model. 

Enable and Config PHP Code Styling

Enable PHP Codestyling libraries and configure basic settings for Drupal, just as in:

    service: appserver
    cmd: "cd /app/backend && vendor/bin/phpcs --standard=Drupal,DrupalPractice --colors --extensions=inc,info,install,module,php,profile,test,theme web/modules/custom web/profiles/st web/themes/custom"
    description: Check code standards.
  phpcbf:
    service: appserver
    cmd: "cd /app/backend && vendor/bin/phpcbf --standard=Drupal,DrupalPractice --colors --extensions=inc,info,install,module,php,profile,test,theme web/modules/custom web/profiles/st web/themes/custom"
    description: Fix code standard violations automatically.

[CFG] - Implement specific Drupal Installation Profile for Summer House

When we're using $ drush si with params from steps inside .ddev/config.yaml, we're installing the standard installation of Drupal, the by-default version. This enable some resources like shortcut module and others, and by now we're merging this profile with our config files doing some weird steps, just like:

 - exec-host: "([ $(ddev drush eval 'print_r(array_keys(\\Drupal::entityTypeManager()->getDefinitions()));' | grep shortcut -c) -gt 0 ] && (ddev drush entity:delete shortcut_set) || (echo 'No shortcut entities were found in your system.'))"
 - exec: "drush pmu shortcut -y"

Just before:

$ drush cim -y"

Trying to align the default installation and the coming configuration values from our existing files. That's weird and add complexity and some points-of-failure to the process. We need something more light for installation, and the solution must be implementing our custom Drupal Installation Profile and then changing when $ drush site-installcomes.

User Story

As developer 
when I'm installing Summer House in my local environment, 
I need a more easy way of charge the related configuration of the platform. 

Check first if file exists or it has to be downloaded

Download external resources only if it doesn't exist in local environment at the moment of starting.
Avoiding:

    - exec-host: "wget https://raw.githubusercontent.com/drud/ddev-contrib/master/docker-compose-services/portainer/docker-compose.portainer.yaml"

Check first if file exists.

[CFG] Change naming for Drupal web container

Change the current name for the docroot in Drupal container (web container in the DDEV context) for something more specific: backend insted of the by-default web, because finally several containers will be focused on different web technologies.

User Story

As developer 
when I'm working with Summer House platform, 
I need a more intuitive naming for folders. 

Move specific URL to env files

Pass specific URLs to environment variables available in .env custom files.
I mean, instead of (config.yaml):

  pre-start:
    - exec-host: "wget https://raw.githubusercontent.com/drud/ddev-contrib/master/docker-compose-services/portainer/docker-compose.portainer.yaml"

Load URL in .env file.

[CFG] - CORS missing headers error

I'm facing problems connecting frontend and backend, all containers within the DDEV-local network. I'm getting a CORS error when I'm requesting drupal nodes by GraphQL queries.

davidjguru_summerhouse_issue_CORS

Can be bypassed using some browser extension, just like: https://addons.mozilla.org/en-US/firefox/addon/access-control-allow-origin/ but it can't be the best soluttion. We need something built-in.

More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin

[CFG] - Review the starting process of Portainer container

When Portainer runs, after some minutes, the container seems to be stopped, automatically. If you re-run the Docker container, after minutes this will be stopped one more time.
In logs:

2022/06/14 13:27:04 No administrator account was created after 5 min. Shutting down the Portainer instance for security reasons.

Review the start-up process and turn off this option.

[BSH] - Control action processing in scripting

Is your feature request related to a problem? Please describe.
In an onboarding context, it is possible for some scripts to execute very severe actions for the host system without explicit confirmation of execution by the user.
This may cause uncalculated damage to the host system, putting other containers / services / data / volumes at risk. Not everyone has a good understanding of the end results that some actions execute.

Describe the solution you'd like
Request user permissions to make changes to the host system when launching project scripts.

User Story

As user/developer 
When I'm executing some scripts, 
I need to be informed in the best possible way of the actions that some scripts will perform
In order to prevent unforeseen changes to my environment.

[CFG] - Ensure mkdocs folder exists and is empty (or rebuild the content)

Describe the bug
There is an error in prompt when ddev is running, due to a previous existence of the mkdocs folder filled with content from the Summer House Wikipedia. The git clone can't be executed and this launch a warning message. So we have to re-think what we can do in ddev start, if is better delete folder / clear and re-get all the mkdocs contents, being always the most updated version of the internal documentation for the mkdocs container.

To Reproduce
Steps to reproduce the behavior:

  1. $ git clone [email protected]:davidjguru/summerhouse.git
  2. $ cd summerhouse
  3. summerhouse$ ddev start
  4. summerhouse$ ddev stop
  5. summerhouse$ ddev start

Expected behavior
Check if mkdocs folder already exists and if is available, just delete content and get a new updated copy of the Summer House wiki content from its related repository.

Screenshots

summerhouse$ ddev start
  Starting summerhouse... 
  A portainer service file has been located in your system.
  A frontend react service file has been located in your system.
  A MkDocs service file has been located in your system.
  fatal: destination path './mkdocs/docs' already exists and is not an empty directory.
  Task failed: Exec command '(git clone https://github.com/davidjguru/summerhouse.wiki.git ./mkdocs/docs)' on the host (sankara): exit status 128 

[CFG] - Organise and separate commands according to process

Describe the bug
When you're running ddev startyour facing a pair of possible scenarios:

  • First installation from zero.
  • Just a single restarting / start in your system.

Right now, both processes are sharing the same steps for the backend_drupal container, for instance running composer install but this can execute changes in your system, altering values and running unnecessary steps if you're only starting up the platform. composer install has not to be executed in every ddev start.

Expected behavior
There must be a separation of processes from the use of ddev start, splitting scenarios from a whole install to a single start/restart.
If the dependencies already exist and are installed (vendor, drupal contrib, etc) composer install will not be executed.

[CFG] - Separate steps for build up in a more intuitive and rational organisation

For the first MVP version of the project, different actions have been assumed to be executed directly as DDEV-hooks, actions hosted in the /.ddev/config.yaml file.

Steps like:

# Resolve all dependencies by Composer in container.
- composer: install 
# Install Drupal after start if not installed already.
- exec: "(drush status bootstrap | grep -q Successful) || (drush site-install --site-name=SummerHouse --account-name=admin --account-pass=admin --db-url=mysql://db:db@db/db -y && drush user-add-role 'administrator' admin)"
- exec: "drush cr"

This can be confusing and messy when it comes to the initial configuration of the project and its deployment. We need to separate responsibilities, define scope at each step and distribute the initial installation/deployment tasks between the following tooling parts:

  1. Composer scripting: pre-install-cmd, pre-update-cmd, post-install-cmd, post-update-cmd.
  2. DDEV Hooks: pre-start, post-start, pre-stop, pre-composer, post-composer, etc.
  3. DDEV custom commands: .ddev/commands/host, .ddev/commands/<container>, .ddev/commands/.

User Story

As developer 
when I want extend the project Summer House with new features related to config/deploy/build up, 
I need a more intuitive and rational organization in order to understand how + where can I do my changes. 

Create installer script for pre-requisites

In order to prepare the basic installation scenario, Summer House require a basic script for installing the resources: Git, Docker, Docker-Compose, DDEV and some packages like wget and related.

Goal: provide a basic script for install basic resources and preparing the scenario for the Summer House Installation.

As developer 
when I want check the project, 
I need a fast tool for install the basic resources in my Linux distro. 

[CFG] - Commands failing in old versions of DDEV

Describe the bug
When you're using versions of DDEV under 1.18 you're facing problems in some installation steps due to non-recognition of special characters, for instance when execute:

- exec-host: "([ $(ddev drush eval 'print_r(array_keys(\\Drupal::entityTypeManager()->getDefinitions()));'

Present in hook pre-start described in config.yml file for DDEV setup. This leads to installation errors and various command execution problems. As the command is not executed correctly, it does not delete the shortcuts and therefore also crashes when importing the configuration.

To Reproduce
Steps to reproduce the behavior:

  1. Use DDEV under 1.19 version.
  2. Run ddev start after git clone ..., etc.
  3. See errors from prompt.

Expected behavior
Download, configure and install all the setup for Summer House as in 1.19 or above versions of DDEV.

Additional context
Related:
ddev/ddev#2547 (comment)
ddev/ddev#1648 (comment)

[FND] - Improve the React frontend

For now the frontend area created with React remains "by-default", with no changes, fixes or layout/styles modifications.
So it is necessary to create a minimal articulation to present the React frontend of the platform: a new layout with ad-hoc styles.

[CFG] - Add a new container for MkDocs

MkDocs is a static site generator for project documentations, it build up a live - wiki from browser using markdown files as source.
It can be interesting add a new specific container for Summer House deploying MkDocs in order to make the platform more self-contained. The markdown source files can be taken from the Github Wiki and then converted to a website pages.

User Story

As developer 
when I'm installing Summer House in my local environment, 
I need the project to be as self-contained as possible to facilitate my installation and learning process. 

Enable a reusable file for local settings

Now the config related files are not being re-usable since we're building a new settings file in every start-up from DDEV, with differentes hashcode for identification. So, the site is different every time we load it. We need a persistent storage for a central settings file and using it always with the same ID. We need folders + scripting + composer + DDEV all in the game.

Goal: Build a mixin' of composer install script + local folder with reusable resources.

As developer 
when I want install the project in a local environment, 
I need a load of the default configuration files, aligned with the hash ID of the site.

[CFG] - Errors in running PHP checks

Errors running phpcs in Github Actions.

Run cd ci
  cd ci
  vendor/bin/phpcs
  shell: /usr/bin/bash -e {0}
ERROR: Referenced sniff "SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" does not exist

In: https://github.com/davidjguru/summerhouse/actions/runs/2623662436

Related:
https://jet.dev/blog/coding-standards-phpcs-drupal-github-actions/
https://www.drupal.org/project/coder/issues/3262291
https://gorannikolovski.com/blog/referenced-sniff-slevomat-coding-standard-does-not-exist

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.