Code Monkey home page Code Monkey logo

ddev-drupal's People

Contributors

hkirsman avatar

Watchers

 avatar  avatar  avatar

ddev-drupal's Issues

Add patch to update grumphp git hook from lando to DDEV aware

We have this in all of our projects:

grumphp:
git_hook_variables:
EXEC_GRUMPHP_COMMAND: lando php

If we start using DDEV, it would always run Lando on git commit.

For now I've created this. More info here wunderio/drupal-project#393
grumphp:
git_hook_variables:
EXEC_GRUMPHP_COMMAND: "[ -d .ddev/traefik/ ] && GRUMPHP_COMMAND='ddev php' || GRUMPHP_COMMAND='lando php' && $GRUMPHP_COMMAND"

I think the ideal solution would be that this package replaces the line in grumph.yml

hooks-db-post-import.sh should also run cim and in case of drush 12 - 'deploy' command?

You probably have some differences in the db that you're importing. Why do the import and then manually run the config import?

This should be changed from:

cd $DDEV_COMPOSER_ROOT && drush cache:rebuild -y && drush @local user:login

to

cd $DDEV_COMPOSER_ROOT && drush deploy && drush @local user:login

Or I guess there should be some drush version check before doing that. If it's 11 or older, let's add cim somewhere near the cr

The original code for this was taken from https://github.com/wunderio/drupal-project/blob/main/.lando.yml#L154

Add php.ini info to readme

Optionally when migrating from Lando you might have something like .lando/php.ini.

You might need to copy this to .ddev/php/php.ini as the default limits might be too low for your local env. For example upload size is 100MB in DDEV.

Add this info to readme.

Add varnishadm command?

In lando we had this:

   varnishadm:
     description: "Runs varnishadm commands"
     service: varnish
     user: root

There's also env variable

VARNISH_ADMIN_HOST: varnish

Create local SonarQube service and tooling?

Example:

.ddev/docker-compose.sonarqube.yaml

# Host requirements:
# sysctl -w vm.max_map_count=524288
# sysctl -w fs.file-max=131072
# ulimit -n 131072
# ulimit -u 8192
services:
  # Based on:
  # https://www.docker.com/blog/how-to-use-the-postgres-docker-official-image/
  # https://github.com/ICTU/sonar
  postgres:
    container_name: ddev-${DDEV_SITENAME}-postgres
    image: postgres:15
    restart: "always"
    cpus: 0.5
    mem_limit: 4096M
    mem_reservation: 1024M
    labels:
      com.ddev.site-name: ${DDEV_SITENAME}
      com.ddev.approot: $DDEV_APPROOT
    # @todo How to create password for "postgres" user?
    user: postgres
    environment:
      POSTGRES_DB: database
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_HOST_AUTH_METHOD: scram-sha-256
      POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
    ports:
      - 5432:5432
    expose:
      - "5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval    : 1s
      timeout: 5s
      retries: 10

  sonarqube:
    container_name: ddev-${DDEV_SITENAME}-sonarqube
    image: sonarqube:10.4-community
    entrypoint: [ /opt/sonarqube/docker/entrypoint.sh ]
    init: true
    # working_dir: "/root"
    # volumes:
    # - sonarqube_data:/opt/sonarqube/data
    # - sonarqube_extensions:/opt/sonarqube/extensions
    # - sonarqube_logs:/opt/sonarqube/logs
    # Not sure if best: https://community.sonarsource.com/t/sonarqube-sometimes-cant-connect-to-postgres-docker-setup/41628
    restart: "unless-stopped"
    cpus: 0.5
    mem_limit: 4096M
    mem_reservation: 1024M
    labels:
      com.ddev.site-name: ${DDEV_SITENAME}
      com.ddev.approot: $DDEV_APPROOT
    ports:
      - 9000:9000
     #- "0.0.0.0:9000:9000"
    # expose:
    #   - "9000"
    environment:
      - SONAR_JDBC_URL=jdbc:postgresql://postgres:5432/database
      - SONAR_JDBC_USERNAME=postgres
      - SONAR_JDBC_PASSWORD=postgres
      - HTTP_EXPOSE=80:9000
      - VIRTUAL_HOST=sonar.${DDEV_HOSTNAME}
      # @todo Binding to all ip's but doesn't seem to work.
      #- SONAR_WEB_HOST=0.0.0.0
      #- DOMAIN=${DDEV_HOSTNAME}
      #- SONAR_HOST_URL=http://${DDEV_HOSTNAME}
    depends_on:
      - postgres

volumes:
  pgdata:
    name: pgdata

Tooling/command run run scan:
.ddev/commands/web/sonar-scanner.sh

#!/usr/bin/env bash

## Description: Run SonarQube scanner locally.
## Usage: sonar-scanner
## Example: "ddev sonar-scanner"

export SONAR_SCANNER_VERSION=5.0.1.3006
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
export SONAR_SCANNER_OPTS="-server"

export SONAR_TOKEN=sqp_5156f0dc5c5197b1f2e501d6ea573827b9b59856

sonar-scanner \
  -Dsonar.projectKey=tua \
  -Dsonar.sources=. \
  -Dsonar.host.url=http://sonarqube:9000

In "ddev pmu" command always do cr before drush pmu

If for some reason the dummy module is already there or you've restored from dump, then ddev pmu might not work as the cr currently happens only if the dummy module is created.

Let's make this change to make this command more bulletproof.
image

Should there be force add for .ddev/.gitignore in readme?

I was creating local setup for one my projects and reliser later that .ddev/.gitignore is not in code. This is needed as ddev adds lots of files that we don't need to commit.

Q:Also why isn't it added? Is it GIT feature? I didn't see .gitignore in my root .gitignore.
A: I think it might be just missing from setup instructions and I added other files?

git add .ddev/.gitignore -f

Create PR template

Always writing the titles from scratch for PR's eg (Description, Screenshots etc) is a bit tedious. Sometimes I might also make a typo or write it differently. Let's create PR template to always have the same base.

From the docs the best one seems creating it in .github folder - out of the way and we could probably add more GitHub related features there.

Based on one previous PR #18 this is the plan:

## Overview



## Screenshots



## Testing




Allow syncdb to be used to sync db from all existing envs

This is my current new code:

#!/bin/bash

#
# Synchronise local database with the production environment.
#
# Based on https://github.com/wunderio/unisport/blob/master/.lando/syncdb.sh
#

set -eu
if [[ -n "${WUNDERIO_DEBUG:-}" ]]; then
    set -x
fi
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

source .ddev/wunderio/core/_helpers.sh

# Pass drush alias as argument and sync the database
# from the remote environment to the local environment.
sync_database_from() {
    alias=$1

    sql_file="$alias-syncdb-$(date +'%Y-%m-%d').sql"

    alias_entry=$(ddev drush sa @$alias)
    ssh_user=$(echo "$alias_entry" | ddev yq '.\"@self.'$alias'\".user' )
    ssh_options=$(echo "$alias_entry" | ddev yq '.\"@self.'$alias'\".ssh.options' )
    ssh_host=$(echo "$alias_entry" | ddev yq '.\"@self.'$alias'\".host' )

    set -x
    # For some reason "ddev drush sql-sync @your-alias @local -y" does not work and times out
    # so we have to do this with sql-dump.
    ssh "$ssh_user@$ssh_host" "$ssh_options" "drush sql-dump --structure-tables-list=cache,cache_*,history,search_*,sessions" > "$sql_file"
    ddev import-db --file="$sql_file"
    #rm "$sql_file"
    { set +x; } 2>/dev/null

    display_status_message "Sync complete!"
}

sync_database_from $1

Create command to create dummy table to allow uninstalling of module

Sometimes when module install or uninstall breaks then Drupal can be in state that you can't uninstall module because table doesn't exist while it's trying to delete it. It doesn't happen that often but then it does, then you have to shell into db, create dummy table, then proceed with module uninstallation. Let's add command in ddev to create dummy table?

Run post db updates after snapshot restore

I've seen at least one error after snapshot restor and clear cache helped.

Also snapshots are probably a little-bit behind the codebase so let's run the same post db import script as we do after db import.

Automatic updates

it would be nice if this package would ask for automatic update if there's one.

Create initial minimal configuration that can be used

  1. What kind of folder/file structure to have?
    Let's create config.wunderio.yaml. This will come later than config.yaml - should we overwrite everything there or not? I guess not otherwise configuration that ddev adds to config.yaml would not work. In other words if developer has created project with drupal10 recipe, then let's allow ddev to configure these in config.yaml.

  2. What's needed to get project started with this package?

Todo:

Add automatic composer install with something like this:

hooks:
  post-start:
    - exec: "[ ! -d \"/var/www/html/vendor\" ] && /var/www/html/.ddev/custom/appserver-build.sh || true"

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.