getdkan / dkan-tools Goto Github PK
View Code? Open in Web Editor NEWCLI tools for DKAN site management
Home Page: https://getdkan.github.io/dkan-tools/
CLI tools for DKAN site management
Home Page: https://getdkan.github.io/dkan-tools/
It would be nice to reproduce our traditional linting workflow in CI locally. IE, to lint only the files we're working on. The CI workflow checks the PR and lints the files that have changed; a local command could accept a base branch as argument, ask git to compare and give a list of modified paths, and lint that list of files.
See guide for upgrade tips.
We now have .circleci working for some projects to use dkan-tools. In the readme, document how to set this up on any project site, and especially how to skip tags or features, or only run a specific tag, in circle behat tests
blocked by #20
Need equivalent of ahoy dkan create-QA-users
create-qa-users:
usage: Create users for each core role for QA purposes
cmd: |
ahoy drush "user-create sitemanager [email protected] --password=sitemanager"
ahoy drush "user-add-role 'site manager' --name=sitemanager"
ahoy drush "user-create editor [email protected] --password=editor"
ahoy drush "user-add-role editor --name=editor"
ahoy drush "user-create creator [email protected] --password=creator"
ahoy drush "user-add-role 'content creator' --name=creator"
I want to have a safe development environment that has all the modules I know I need enabled.
When I pull the production DB to my dev environment, I want operations specific to that transition to happen before I start working on my local environment.
When I push new code and the CI server pulls the code to run tests, I want a second set of operations specific to that transition to happen before tests run.
I want a minimum of confusion about where environment switching logic occurs.
Create a second ticket with full implementation details and acceptance criteria.
Child of #16
The original goal for this project was that docker would be the only requirement. There should be a way to download a built version (with autoload and vendor folder).
User Story
The README doc is getting too long and hard to use. Let's upgrade this to a https://www.mkdocs.org/ -like format.
Acceptance Criteria
Documentation is broken into clear sections.
The standard procedure for running tests in DKAN implementation projects ("clients") will be to run only tests that have a @smoketest
tag (as opposed to running the full suite on PRs against DKAN repo).
Document how to set this up in a new project in the README using circle config. Also document other use-cases of filtering tests.
Right now, if a command is not able to continue but has not run a task that produced an error yet, we are throwing an exception. This standard should be replaced with something that still displays an error on the terminal but 1) would exit if calling the command directly, or 2) would return an object that communicates the error state similarly to returning a task result with an exit code of 1.
Child of #19
A first crack at testing suite for DKAN Tools
Child of #19
Currently there is a deployment script built into DKAN starter. The environment switch is part of this, but the deployment script is broader and run in all environments upon deployment, including steps like registry rebuild, updb, etc. Some equivalent of this is still needed and must work with Acquia deployment hooks, but the current architecture is very hard to understand and could be greatly simplified.
Goals:
Implementation?
Child of #16
The DKAN namespace is not really well-defined and we can reorganize the commands to be more intuitive. Also, there is nothing that says this needs to work only for DKAN, let's just use profile
when necessary.
This is the current list of dktl commands:
composer Proxy to composer.
drush Run drush command on current site.
help Displays help for a command
init Initialize DKAN project directory.
list Lists commands
phpcbf Proxy to phpcbf.
phpcs Proxy to phpcs.
test Test some things.
dkan
dkan:deploy Performs common tasks when switching databases or code bases.
dkan:get Get DKAN.
dkan:install Run DKAN DB installation. Pass --backup (-b) to restore from last backup.
dkan:make Run the DKAN make file and apply any overrides from /config.
dkan:restore Restore files and database.
docker
docker:compose Run a docker-compose command. E.g. "dktl docker:compose ps".
docker:surl Display the secure (https) web URL for the current project.
docker:url Display the web URL for the current project.
drupal
drupal:install-min Run Drupal minimal installation script. Takes mysql url as optional argument.
drupal:make Run make for Drupal core.
drupal:remove-git-ignores Remove all gitignores from docroot.
drush
drush:uli Run "drush uli" command with correct ULI argument.
init
init:cicle-ci Generates basic configuration for a DKAN project to work with CircleCI.
init:host Initialize host settings.
init:probo-ci Generates basic configuration for a DKAN project to work with ProboCI.
test
test:behat Runs DKAN core Behat tests.
test:init Initialize test folders and install dependencies for running tests.
test:lint Preconfigured linting for paths inside of the repo.
test:lint-fix Preconfigured lint fixing for paths inside of the repo.
test:phpunit Runs DKAN core PhpUnit tests.
Let's change to:
composer Proxy to composer.
deploy Performs common tasks when switching databases or code bases.
drush Run drush command on current site.
help Displays help for a command
init Initialize DKAN project directory.
list Lists commands
make Run the Drupal and profile make files and apply any overrides from /config.
phpcbf Proxy to phpcbf.
phpcs Proxy to phpcs.
profile
profile:get Get the profile.
profile:install Run profile DB installation.
docker
docker:compose Run a docker-compose command. E.g. "dktl docker:compose ps".
docker:surl Display the secure (https) web URL for the current project.
docker:url Display the web URL for the current project.
drupal
drupal:install-min Run Drupal minimal installation script. Takes mysql url as optional argument.
init
init:cicle-ci Generates basic configuration for a DKAN project to work with CircleCI.
init:host Initialize host settings.
init:probo-ci Generates basic configuration for a DKAN project to work with ProboCI.
restore
restore:db Restore the db from a remote or local backup
restore:files Restore the files dir(s) from a remote backup
test
test:behat Runs DKAN core Behat tests.
test:init Initialize test folders and install dependencies for running tests.
test:lint Preconfigured linting for paths inside of the repo.
test:lint-fix Preconfigured lint fixing for paths inside of the repo.
test:phpunit Runs DKAN core PhpUnit tests.
This may not require any changes to dktl tool, but rather creating a bash script in dkan's .circle folder that makes the paralelization work. Perhaps a helper PHP function is needed to recreate some of the logic currently in the ruby scripts.
Work has been happening both in dkan-tools and in the dkan repo:
https://github.com/GetDKAN/dkan/tree/dktl-circle
https://github.com/GetDKAN/dkan-tools/tree/exit
Robo provides a way to handle temporary directory. In Utils there is also a mechanism. They are both being used. Lets stick with the Robo mechanism for now.
Can't create dir in docroot to symlink to? Needs some experimentation but hopefully an easy fix.
Once our images have been updated, switch to using the new PHP7 container for web server in DKTL.
ERROR: No container found for cli_1
this should be detected by the bash scriptdocker-compose up -d
The two main dependencies have BSD-2 and MIT licenses, which means we should be able to release this with a GPL license. Do some research to see if robo's dependencies are all compatable and add a LICENSE.txt.
Child of #19
It would be good to investigate why so many tests are failing with the basic CircleCI configuration. It could be connected to #54, so lets make sure we address that first.
I want patches to be easy to apply as part of the make process
??I want to easily generate patches when I have modified the Drupal or DKAN codebase??
When using the dkan:restore command, either uncompressed, zipped or tarball/gzipped files should work for db dumps or files.
Child of #19
After some discussion, we have settled on the following structure for a dktl project root:
dktl.yml
dkan/
src/
modules/
themes/
make/
site/
tests/
docroot/
Update the init command to implement this site structure. Also update drupal:make commands to make symlinks correct.
Child of #16
nice to haves
vnc:
usage: Prints the project VNC URL
cmd: |
VNC_PORT=`ahoy docker compose port browser 5900|cut -d ':' -f2`
if [ "$AHOY_CMD_PROXY" = "DOCKER" ] && [ "$(ahoy docker proxy-running)" = "1" ]; then
echo "$(ahoy docker get-hostname):${VNC_PORT}"
else
if [ -z "$DOCKER_MACHINE_NAME" ]; then
echo "`ahoy docker web-host`:${VNC_PORT}"
else
echo "`docker-machine ip default`:${VNC_PORT}"
fi
fi
cleanup:
usage: Clean ups docker unused images and volumes. See http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/.
cmd: |
EXITED=`docker ps -a -q -f status=exited`
DANGLING=`docker images -f "dangling=true" -q`
if [ ! -z "$EXITED" ]
then
docker rm -v $EXITED
fi
if [ ! -z "$DANGLING" ]
then
docker rmi $DANGLING
fi
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
#9 introduces a chown
command at the end of every run of the bash script that changes ownership of any root files to the current user. This addresses the common problem in docker that files created by the cli container appear to be owned by "root" to the host machine.
The solution needs to be environment-specific, as one would want to use the chown command in their local environment but not in the CI.
DKTL_CHOWN
is checked before running the chown
command. If set to FALSE
it will not run.We need some wrappers around Drupal coder commands for dktl.
dktl test:lint
command runs the normal phpcs Drupal linting commanddktl test:lint-fix
command runs phpcbf
to fix fixable issues and outputs the diff.Child of #19
Once GetDKAN/dkan#2643 is complete, remove the DKAN Tools module from the assets directory, and remove all references to it from commands.
Add basic behat and phpUnit commands.
Child of #16
Add two scenarios/tutorials to the README:
We store DB dumps and file archives in S3, and need to use S3 tooling to get at these private files.
Connecting to our memcache container takes a bit of configuration. We should add it to settings.docker.php.
Most of the commands provided by dkan-tools will work with just the cli container, yet we download all of the images and build all the containers no matter what we are doing.
It would be useful to run, only the necessary containers for a given command, this would make the tool more accessible (less bloated).
branch: dkan2
PHP Fatal error: Uncaught Error: Call to undefined method DkanTools\Drupal\V7\InitCommands::directoryAndFileCreationCheck() in /usr/local/dkan-tools/src/Drupal/V7/InitCommands.php:43
Stack trace:
#0 /usr/local/dkan-tools/src/Drupal/V7/InitCommands.php(23): DkanTools\Drupal\V7\InitCommands->createDktlYmlFile()
#1 [internal function]: DkanTools\Drupal\V7\InitCommands->init(Array)
#2 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/CommandProcessor.php(235): call_user_func_array(Array, Array)
#3 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/CommandProcessor.php(181): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/CommandProcessor.php(150): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/AnnotatedC in /usr/local/dkan-tools/src/Drupal/V7/InitCommands.php on line 43
ERROR: Uncaught Error: Call to undefined method DkanTools\Drupal\V7\InitCommands::directoryAndFileCreationCheck() in /usr/local/dkan-tools/src/Drupal/V7/InitCommands.php:43
Stack trace:
#0 /usr/local/dkan-tools/src/Drupal/V7/InitCommands.php(23): DkanTools\Drupal\V7\InitCommands->createDktlYmlFile()
#1 [internal function]: DkanTools\Drupal\V7\InitCommands->init(Array)
#2 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/CommandProcessor.php(235): call_user_func_array(Array, Array)
#3 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/CommandProcessor.php(181): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/CommandProcessor.php(150): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /usr/local/dkan-tools/vendor/consolidation/annotated-command/src/AnnotatedC
in /usr/local/dkan-tools/src/Drupal/V7/InitCommands.php:43
V7
on /bin/app.php line 6dktl init
I want to be able to clone a project site and pull down the DB for development.
Somewhat arbitrary list of features moving toward a 1.0 release.
Child of #16
I want to pull a site database and run deployment commands, so that I can have a local sandbox that mirrors production.
In ahoy, this is accomplished with the site up command.
Acceptance criteria:
Child of #19
Child of #19
The new Datastore module should make the Feeds module unnecessary. Let's include an update hook that will disable the module.
We probably need to keep the module in the codebase for a few more releases so that it doesn't break.
The 'dkan:restorecommand restores the db from a dump at a URL. The
dkan:installcommand restores a db backup from the /backups folder if given a
-b` switch. These could be consolidated to make all this more intuitive.
restore
command out of the dkan
namespace.restoreDb()
command public instead of private, so we can do either dktl restore
for both or dktl restore:db
for just the db.restoreDb()
method restore from a URL if given the argument.For instance:
$ dktl restore:db
The following backups are available to restore:
[1] last_backup.sql
[2] some_other_backup.sql.gz
It would be good to include an example make file with some commonly-used add-on modules, such as memcache and the Acquia modules. This should go in the documentation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.