drupal-graphql / drupal-decoupled-app Goto Github PK
View Code? Open in Web Editor NEWDecoupled Drupal demo application based on React, GraphQL and Apollo including server-side rendering.
License: MIT License
Decoupled Drupal demo application based on React, GraphQL and Apollo including server-side rendering.
License: MIT License
docker-compose build
ERROR: Service "cli" mounts volumes from "amazeeio-ssh-agent", which is not the name of a service or container.
I think there might be a service definition missing from your docker-compose.yml
, when I run docker-compose up -d
I get:
15:19 $ docker-compose up -d
ERROR: Service "drupal" mounts volumes from "amazeeio-ssh-agent", which is not the name of a service or container.
I found a bug in the package @amazee/react-scripts
this repo is using. Unfortunately the github-project (https://github.com/AmazeeLabs/amazee-js) is not longer available. Any suggestions how to file the bug now? Would be great if @Schnitzel or @fubhy could bring it back. ๐
I get an unexpected error on yarn install
with trace:
Error: https://registry.yarnpkg.com/@amazee/persistgraphql/-/persistgraphql-0.3.2.tgz: invalid tar file
When running "docker-build" out the box I get the following error:
ERROR: Service "cli" mounts volumes from "amazeeio-ssh-agent", which is not the name of a service or container.
Use stylelint instead of CSSLint to avoid errors and enforce consistent conventions in stylesheets.
Suggestions:
frontend/src/**
and backend/web/themes/**
:)
Hello,
I have generated the keys but at the moment of run the command: ssh-key-add.cmd C:\Users\[yourname]\.ssh\id_rsa
, i get the following message:
Unable to find image 'amazeeio/ssh-agent:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/amazeeio/ssh-agent/manifests/latest: unauthorized: incorrect username or password.
See 'docker run --help'.
What could be the problem?
Thanks
When I run drush si config_installer
inside the container, it fails with a permission error. I followed the "Usage" instructions in the readme. All files (including sites/default/settings.php
) are owned by my user id and group id and have -rwxrwxr-x permissions, while the container runs as uid 1000. I cannot work around this by specifying a different --user
option to docker-compose exec
, as only the drupal
user (uid 1000) has access to the Drupal directory /var/www/drupal/
.
$ docker-compose exec --user drupal drupal bash
๐ณ [email protected]:~/public_html/backend/web (master *=)$ drush si config_installer -y --account-name=admin --account-pass=admin
You are about to DROP all tables in your 'drupal' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok]
file_put_contents(sites/default/settings.php): failed to open stream: Permission denied install.inc:337 [warning]
Exception: Failed to modify <em class="placeholder">sites/default/settings.php</em>. Verify the file permissions. in /var/www/drupal/public_html/backend/web/core/includes/install.inc:338 [error]
Stack trace:
#0 /var/www/drupal/public_html/backend/web/profiles/contrib/config_installer/src/Form/SiteConfigureForm.php(121): drupal_rewrite_settings(Array)
#1 [internal function]: Drupal\config_installer\Form\SiteConfigureForm->buildForm(Array, Object(Drupal\Core\Form\FormState), Array)
#2 /var/www/drupal/public_html/backend/web/core/lib/Drupal/Core/Form/FormBuilder.php(514): call_user_func_array(Array, Array)
#3 /var/www/drupal/public_html/backend/web/core/lib/Drupal/Core/Form/FormBuilder.php(472): Drupal\Core\Form\FormBuilder->retrieveForm('config_installe...', Object(Drupal\Core\Form\FormState))
#4 /var/www/drupal/public_html/backend/web/core/includes/install.core.inc(909): Drupal\Core\Form\FormBuilder->submitForm('Drupal\\config_i...', Object(Drupal\Core\Form\FormState))
#5 /var/www/drupal/public_html/backend/web/core/includes/install.core.inc(584): install_get_form('Drupal\\config_i...', Array)
#6 /var/www/drupal/public_html/backend/web/core/includes/install.core.inc(540): install_run_task(Array, Array)
#7 /var/www/drupal/public_html/backend/web/core/includes/install.core.inc(117): install_run_tasks(Array)
#8 /var/www/drupal/public_html/backend/vendor/drush/drush/includes/drush.inc(726): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#9 /var/www/drupal/public_html/backend/vendor/drush/drush/includes/drush.inc(711): drush_call_user_func_array('install_drupal', Array)
#10 /var/www/drupal/public_html/backend/vendor/drush/drush/commands/core/drupal/site_install.inc(82): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array)
#11 /var/www/drupal/public_html/backend/vendor/drush/drush/commands/core/site_install.drush.inc(255): drush_core_site_install_version('config_installe...', Array)
#12 /var/www/drupal/public_html/backend/vendor/drush/drush/includes/command.inc(422): drush_core_site_install('config_installe...')
#13 /var/www/drupal/public_html/backend/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#14 /var/www/drupal/public_html/backend/vendor/drush/drush/includes/command.inc(199): drush_command('config_installe...')
#15 /var/www/drupal/public_html/backend/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#16 /var/www/drupal/public_html/backend/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#17 /var/www/drupal/public_html/backend/vendor/drush/drush/drush.php(12): drush_main()
#18 {main}
If I see it correct there is in the frontend/server/index.ts
no handling for static files. Something like server.use("/_next/static", express.static(path.join(__dirname, '../static')));
could be usefull.
Make it work in tandem with Lagoon.
Maybe it would be good to have clarity about the licence of this repo. Should I PR a MIT-Licence?
Hi,
yarn build
fails with this error...
Any ideas how to fix it?
/src/components/Router/index.tsx
`
const withQuery = graphql<
IRouterQueryProps,
IRouterQueryData,
IRouterQueryVariables,
IRouterQueryChildProps
(query, {
options: props => ({
variables: {
path: props.url.asPath,
},
}),
props: ({ ownProps, data }) => ({
...ownProps,
entity: data.route && data.route.entity,
loading: data.loading,
}),
});
`
When trying to run docker-compose up -d.
I get command not found. I have tried docker and it gives me the help of the different command. I double checked that the yml file was correctly named but I am still getting the error.
Here is my first time user experience following the installation guide in README.md
cd backend && composer install --- works as expected
cd frontend && yarn install --- I am seeing warning and errors related to missing dependencies
Initially a bunch of warnings .. which seem easy enough to fix and then a fatal error .. I will list them below.. I am looking into this now .. but I think there is nothing here that cannot be resolved by tightening up some dependencies
A) Warning
warning " > [email protected]" has unmet peer dependency "[email protected] || ^0.12.0".
warning " > [email protected]" has unmet peer dependency "graphql@^0.11.0 || ^0.12.0".
warning " > [email protected]" has unmet peer dependency "graphql@^0.11.3 || ^0.12.3".
warning " > [email protected]" has unmet peer dependency "graphql@^0.11.0 || ^0.12.3".
warning " > [email protected]" has unmet peer dependency "graphql@^0.11.0".
warning " > [email protected]" has unmet peer dependency "redux@^2.0.0 || ^3.0.0".
warning "react-apollo > [email protected]" has unmet peer dependency "enzyme@^3.0.0".
warning " > [email protected]" has unmet peer dependency "history@^4.7.2".
warning "@amazee/react-scripts > @amazee/[email protected]" has unmet peer dependency "babel-runtime@^6.23.0".
warning "@amazee/react-scripts > [email protected]" has unmet peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0".
warning "@amazee/react-scripts > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
warning "@amazee/react-scripts > [email protected]" has unmet peer dependency "postcss@^6.0.0".
warning "@amazee/react-scripts > [email protected]" has incorrect peer dependency "react@^15.6.2".
warning "@amazee/react-scripts > [email protected]" has incorrect peer dependency "webpack@^1.0||^2.1.0-beta||^2.2.0-rc".
B) The error
warning Error running install script for optional dependency: "/Users/martin/sites/drupal-decoupled-app/frontend/node_modules/fsevents: Command failed.\nExit code: 1\nCommand: node-pre-gyp install --fallback-to-build\nArguments: \nDirectory: /Users/martin/sites/drupal-decoupled-app/frontend/node_modules/fsevents\nOutput:\nnode-pre-gyp info it worked if it ends with ok\nnode-pre-gyp info using [email protected]\nnode-pre-gyp info using [email protected] | darwin | x64\nnode-pre-gyp info check checked for "/Users/martin/sites/drupal-decoupled-app/frontend/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node" (not found)\nnode-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v59-darwin-x64.tar.gz\nnode-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v59-darwin-x64.tar.gz\nnode-pre-gyp ERR! Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v59-darwin-x64.tar.gz \nnode-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI, unknown) (falling back to source compile with node-gyp) \nnode-pre-gyp http 404 status code downloading tarball https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v59-darwin-x64.tar.gz \nnode-pre-gyp ERR! build error \nnode-pre-gyp ERR! stack Error: Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)\nnode-pre-gyp ERR! stack at ChildProcess. (/Users/martin/sites/drupal-decoupled-app/frontend/node_modules/node-pre-gyp/lib/util/compile.js:77:29)\nnode-pre-gyp ERR! stack at ChildProcess.emit (events.js:159:13)\nnode-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:207:12)\nnode-pre-gyp ERR! stack at onErrorNT (internal/child_process.js:389:16)\nnode-pre-gyp ERR! stack at process._tickCallback (internal/process/next_tick.js:152:19)\nnode-pre-gyp ERR! System Darwin 17.3.0\nnode-pre-gyp ERR! command "/usr/local/Cellar/node/9.3.0_1/bin/node" "/Users/martin/sites/drupal-decoupled-app/frontend/node_modules/fsevents/node_mโจ Done in 210.45s.
Realize this would be a feature request but it would be great to see an example logging in and accessing content that requires authenticated permissions.
The examples and documentation for handling this common situation seem to be pretty sparse, especially in the decoupled drupal world. I'm not sure if there is a viable solution for authenticating and returning an appropriate JWT token that would work for future request.
Great project and thanks for sharing. You guys do some pretty amazing work.
After running yarn run dev
, I'm getting this error:
error Couldn't find a package.json file in "/var/www/drupal/public_html/backend/web"
Does the Drupal installation need a packages file?
It will be excellent to have a simple bash file with a set commands that would automate the startup and stop process of the environment.
Oversimplified example on a Mac and Linux:
filename: process.sh
#!/usr/bin/env bash
# Validate tools are installed
if [ $(which composer) == '' ]; then
echo -e "Composer is not installed"
exit 1;
fi
if [ $(which yarn) == '' ]; then
echo -e "Yarn is not installed"
exit 1;
fi
if [ $(which docker-compose) == '' ]; then
echo -e "Docker Compose is not installed"
exit 1;
fi
if [ $(which pygmy) == '' ]; then
echo -e "Pygmy is not installed"
exit 1;
fi
# Simple wrapper functions
function install_backend() {
cd backend
composer install
cd ../
}
function install_frontend() {
cd frontend
yarn install
cd ../
}
function start() {
install_backend
install_frontend
pygmy up
docker-compose up -d
}
function stop() {
pygmy down
docker-compose down
}
function nuke() {
stop
docker rm $(docker ps -aq)
docker rmi $(docker images -aq)
rm -rf frontend/node_modules
rm -rf backend/vendor
}
$@```
and it gets called with:
- `./process.sh start` // Start Process
- `./process.sh stop` // Stop Process
- `./process.sh nuke` // Nuke All
Hey hey. So when we try to composer update
we get the following error. While this may not be specific to graphql etc, it may be for the setup of the drupal codebase.
Problem 1
- Installation request for symfony/class-loader ~3.2.8 -> satisfiable by symfony/class-loader[3.2.x-dev, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.8, v3.2.9].
- drupal/core 8.3.7 requires symfony/class-loader ~2.8 -> satisfiable by symfony/class-loader[2.8.x-dev].
- drupal/core 8.3.7 requires symfony/class-loader ~2.8 -> satisfiable by symfony/class-loader[2.8.x-dev].
- drupal/core 8.3.7 requires symfony/class-loader ~2.8 -> satisfiable by symfony/class-loader[2.8.x-dev].
- Conclusion: don't install symfony/class-loader 2.8.x-dev
- Installation request for drupal/core (locked at 8.3.7, required as ~8.0) -> satisfiable by drupal/core[8.3.7].
I followed the instructions in the README.md and I get the following error. Do I need to setup up mysql on my machine or is it included in one of the docker images?
$ docker-compose run --user drupal drupal bash
Pulling drupal (amazeeio/drupal:php70-solr)...
php70-solr: Pulling from amazeeio/drupal
6ffe5d2d6a97: Pull complete
f4e00f994fd4: Pull complete
e99f3d1fc87b: Pull complete
a3ed95caeb02: Pull complete
ededd75b6753: Pull complete
1ddde157dd31: Pull complete
230191ce0903: Pull complete
b0ffc7d1ccfe: Pull complete
0678524a0f5a: Pull complete
da81a110ed73: Pull complete
d84d2ff0e00d: Pull complete
9158cdd394ce: Pull complete
c8b0af747039: Pull complete
734271ead33d: Pull complete
efb46f90acd6: Pull complete
f8250dcc3017: Pull complete
7ff3f6023ac7: Pull complete
b12d3175d60b: Pull complete
2883bd0d59a1: Pull complete
Digest: sha256:12500e872a7fa25aa10c981af5f9965e0311257fa240d2fad10e4860e5a215fd
Status: Downloaded newer image for amazeeio/drupal:php70-solr
๐ณ [email protected]:~/public_html/backend/web (master)$ drush si config_installer -y --account-name=admin --account-pass=admin
You are about to CREATE the 'drupal' database. Do you want to continue? (y/n): y
Failed to create database: ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' [error]
(111 "Connection refused")
/cc @Schnitzel
Thanks for the demo! I really appreciate it.
I'm wondering if there is a way to include static files in the build folder similar to how the create-react-app copies the public folder content to the build directory:
https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#using-the-public-folder
Also, is there any reason this approach/file structure should not be used in production?
If I fetch something from the GraphQL-Server I get from the Server-Side-Rendering <div>loading...</div>
instead of my data. Any idea how to make the SSR waiting for the data?
// home.jsx
...
import query from "./query.gql";
import withApollo from "~/shared/withApollo";
export const Home: StatelessComponent<{}> = ({ loading, entities }) => {
console.log('entities', entities)
if (loading) {
return <div>loading...</div>;
}
return (
<div>{entities.map(item => "...")}</div>
);
};
const withQuery = graphql(query, {
props: ({ ownProps, data }) => ({
...ownProps,
entities: data.nodeQuery && data.nodeQuery.entities,
loading: data.loading
})
});
// export default Home;
export default compose(withApollo, withQuery)(Home);
Getting a 403 when clicking on the node overview
link or any node that I've created.
I'm able to use the graphql explorer perfectly fine on the Drupal side.
I must be missing a step. Would I have to set up JWT with the frontend myself or does some of that work out-of-the-box?
yarn install
fails with:
error An unexpected error occurred: "https://registry.yarnpkg.com/@amazee/persistgraphql/-/persistgraphql-0.3.2.tgz: Request failed \"404 Not Found\"".
Stack trace:
Trace:
Error: https://registry.yarnpkg.com/@amazee/persistgraphql/-/persistgraphql-0.3.2.tgz: Request failed "404 Not Found"
at Request.handleRequestError (/usr/local/Cellar/yarn/0.23.2/libexec/lib/fetchers/tarball-fetcher.js:205:20)
at emitOne (events.js:96:13)
at Request.emit (events.js:191:7)
at Request.onRequestResponse (/usr/local/Cellar/yarn/0.23.2/libexec/node_modules/request/request.js:1074:10)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:191:7)
at HTTPParser.parserOnIncomingClient (_http_client.js:522:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
at TLSSocket.socketOnData (_http_client.js:411:20)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:191:7)
Not sure if I'm doing it right but i am under the impression that the only page in this example that is being delivered by the server is /home
. At least out of the box, overview, articles and pages are missing in the initial source file after running through the steps provided in the readme.
We need this to be able to share build artifacts (e.g. adding persisted queries to the backend that are generated during the frontend build).
I've just installed Lagoon and attempted to build this project per the instructions in the readme file. However, the "docker-compose build" step is failing with the following error messages:
=> [drupal-decoupled-app_frontend internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CANCELED [drupal-decoupled-app internal] load metadata for docker.io/amazeeio/php:7.1-cli-drupal 0.7s
=> CANCELED [drupal-decoupled-app_nginx internal] load metadata for docker.io/amazeeio/nginx-drupal:latest 0.6s
=> ERROR [drupal-decoupled-app_php internal] load metadata for docker.io/library/drupal-decoupled-app:latest 0.6s
=> CANCELED [drupal-decoupled-app_php internal] load metadata for docker.io/amazeeio/php:7.1-fpm 0.6s
=> CANCELED [drupal-decoupled-app_frontend internal] load metadata for docker.io/amazeeio/node:8 0.6s
=> CANCELED [drupal-decoupled-app_frontend internal] load metadata for docker.io/amazeeio/node:8-builder 0.6s
------
> [drupal-decoupled-app_php internal] load metadata for docker.io/library/drupal-decoupled-app:latest:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Has something changed or am I missing a setup step somewhere?
My setup steps have been (after cloning this git repo):
gem install pygmy
pygmy up
docker-compose build
Thank you.
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.