Code Monkey home page Code Monkey logo

graphql-starter-kit's Introduction

GraphQL
GraphQL Starter Kit

High-performance GraphQL API server, database dev tools, and React front-end.

Features

    


This project was bootstrapped with GraphQL Starter Kit. Be sure to join our Discord channel for assistance.

Directory Structure

├──.github — GitHub configuration including CI/CD workflows.
├──.vscode — VSCode settings including code snippets, recommended extensions etc.
├──app — front-end application (Vite, Vitest, React, Joy UI).
├──db — database schema, seeds, and migrations (PostgreSQL).
├──infra — cloud infrastructure configuration (Terraform).
├──scripts — automation scripts shared across the project.
├──server — backend server (GraphQL Yoga, Pothos GraphQL).
└── ... — add more packages such as worker, admin, mobile, etc.

Requirements

Getting Started

Just clone the repo and, install project dependencies and bootstrap the PostgreSQL database:

$ git clone https://github.com/kriasoft/graphql-starter-kit.git example
$ cd ./example                  # Change current directory to the newly created one
$ corepack enable               # Ensure Yarn is installed
$ yarn install                  # Install project dependencies
$ yarn db create                # Create a new database if doesn't exist
$ yarn db migrate --seed        # Migrate and seed the database

From there on, you can launch the app by running:

$ yarn workspace server start   # Or, `yarn server:start`
$ yarn workspace app start      # Or, `yarn app:start`

The GraphQL API server should become available at http://localhost:8080/.
While the front-end server should be running at http://localhost:5173/.

IMPORTANT: Tap Shift+Cmd+P in VSCode, run the TypeScript: Select TypeScript Version command and select the workspace version.

How to Update

In the case when you kept the original GraphQL Starter Kit git history, you can always pull and merge updates from the "seed" repository back into your project by running:

$ git fetch seed                # Fetch GraphQL Starter Kit (seed) repository
$ git checkout main             # Switch to the main branch (or, master branch)
$ git merge seed/main           # Merge upstream/master into the local branch

In order to update Yarn and other dependencies to the latest versions, run:

$ yarn set version latest       # Upgrade Yarn CLI to the latest version
$ yarn upgrade-interactive      # Bump Node.js dependencies using an interactive mode
$ yarn install                  # Install the updated Node.js dependencies
$ yarn dlx @yarnpkg/sdks vscode # Update VSCode settings

Backers

              

How to Contribute

We welcome contributions through pull requests and issues on our GitHub repository. Feel free to also start a conversation on our Discord server to discuss potential contributions or seek guidance.

License

Copyright © 2014-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE file.

graphql-starter-kit's People

Contributors

0xflotus avatar aarmand avatar andrewkslv avatar andrewstec avatar aron123 avatar b-gran avatar buildbreakdo avatar bwoodlt avatar cmmartin avatar daveyedwards avatar dependabot-preview[bot] avatar dinno avatar domenicocolandrea86 avatar ericpelland avatar glennreyes avatar kernelsoe avatar koistya avatar kyledetella avatar lifeiscontent avatar maciej-ka avatar psyanite avatar rbadillap 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  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  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  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  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  avatar  avatar

graphql-starter-kit's Issues

docker-compose builds as root

First, thank you very much for this wonderful node-boilerplate, It really does cover a long tech stack which I am trying to complete bit by bit.

Problem which I encountered when I tried to run this as described, simply did:
cd nodejs-api-starter
docker-compose up

And I get this error:
api_1 | EACCES: permission denied, mkdir 'build/emails'
api_1 | EACCES: permission denied, mkdir 'build/emails'
...
and so on.

The problem here is that the build directory created by running build.js through docker-compose is root protected and doesn't allow any further changes, so the build process fails and finally the ./build/server.js is unavailable. I can manually create a build directory that is not root protected and repeat the process then it works. Probably something to do with docker's functioning and my lack of experience in working with it. Can you help me figure out a work around?

screenshot:
http://i.imgur.com/ckiomWY.png

App is not starting up

I just clone the project and on the root of the project :

  1. Run npm install
  2. docker-compose up

I am actually getting on my log -->

api_1    | Error: Cannot find module './server.js'
api_1    |     at Function.Module._resolveFilename (module.js:536:15)
api_1    |     at Function.Module._load (module.js:466:25)
api_1    |     at Module.require (module.js:579:17)
api_1    |     at require (internal/module.js:11:18)
api_1    |     at Socket.process.stdin.on.data ([eval]:1:68)
api_1    |     at emitOne (events.js:116:13)
api_1    |     at Socket.emit (events.js:211:7)
api_1    |     at addChunk (_stream_readable.js:263:12)
api_1    |     at readableAddChunk (_stream_readable.js:250:11)
api_1    |     at Socket.Readable.push (_stream_readable.js:208:10)
api_1    |     at Pipe.onread (net.js:594:20)

captura de pantalla 2018-02-12 a las 1 16 50 2

Why its happening? Kind regards

Watcher producing blank builds

I've tried to debug this one to the core, at some point across many ubuntu boxes I'm seeing watched build files produced that only have the following:

"use strict";
//# sourceMappingURL=Users.js.map

At some point in the babel read script the src files are being read as blank, and somehow the above is produced. The only thing I'm noticing is that when the build works, the "use strict" is in single quotes (and of course, the actual build code follows). Sometimes re-saving works, sometimes not. Also, if you save too many times in a row, the watcher just crashes.

Any ideas (or build alternatives)?

Deployment docs

Thanks very much for your work on this repo @koistya et al. It would be helpful to see a step-by-step walkthrough of deployment to, e.g., DigitalOcean from one's development machine. It's super-easy to get the repo running locally but not at all clear how to use the deployment or other scripts you have included to get the starter running on, say, DigitalOcean.

Unable to install on Windows 10

I've tried to get this running using the default development configuration on 3 different windows 10 machines without success.

Here are the steps I am taking:

  1. Update Docker to latest version (currently version 17.06.0-ce, build 02c1d87)
  2. Clone and run docker-compose up as instructed

git clone https://github.com/kriasoft/nodejs-api-starter.git example-api
cd example-api # Change current directory to the newly created one
docker-compose up # Launch Docker containers with the Node.js API app running inside

  1. Try to seed databases in spite of error from above step.

    winpty docker-compose exec api yarn db-seed

  2. Notice more errors. Try the process again by executing docker-compose down followed by docker-compose up

Below is the output from steps 2-4.

$ docker-compose up
Creating network "exampleapi_default" with the default driver
Creating volume "exampleapi_redis" with default driver
Creating volume "exampleapi_db" with default driver
Creating volume "exampleapi_yarn" with default driver
Pulling redis (redis:4.0.1-alpine)...
4.0.1-alpine: Pulling from library/redis
Digest: sha256:e633cded055a94202e4ccccb8125b7f383cd6ee56527ab890db643383a2647dd
Status: Downloaded newer image for redis:4.0.1-alpine
Pulling db (postgres:9.6.4-alpine)...
9.6.4-alpine: Pulling from library/postgres
Digest: sha256:5fd73de311d304caeb4f907d4f559d322805abc622e4baf5788c6a079ee5224e
Status: Downloaded newer image for postgres:9.6.4-alpine
Pulling api (node:8.3.0-alpine)...
8.3.0-alpine: Pulling from library/node
Digest: sha256:811180c902c56e594832bc553bfc5ba8315959a55d453e045bfe77af9b2341cb
Status: Downloaded newer image for node:8.3.0-alpine
Pulling nginx (nginx:1.13.3-alpine)...
1.13.3-alpine: Pulling from library/nginx
Digest: sha256:24a27241f0450b465f9e9deb30628c524aa81a1aa6936daa41ef7c4345515272
Status: Downloaded newer image for nginx:1.13.3-alpine
Creating exampleapi_redis_1 ...
Creating exampleapi_db_1 ...
Creating exampleapi_db_1
Creating exampleapi_db_1 ... done
Creating exampleapi_api_1 ...
Creating exampleapi_api_1 ... done
Creating exampleapi_nginx_1 ...
Creating exampleapi_nginx_1 ... done
Attaching to exampleapi_redis_1, exampleapi_db_1, exampleapi_api_1, exampleapi_n ginx_1
redis_1 | 1:C 16 Aug 15:41:22.078 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0 Oo
redis_1 | 1:C 16 Aug 15:41:22.079 # Redis version=4.0.1, bits=64, commit=000000 00, modified=0, pid=1, just started
db_1 | The files belonging to this database system will be owned by user "po stgres".
redis_1 | 1:C 16 Aug 15:41:22.079 # Warning: no config file specified, using th e default config. In order to specify a config file use redis-server /path/to/re dis.conf
db_1 | This user must also own the server process.
api_1 | yarn install v0.27.5
db_1 |
redis_1 | 1:M 16 Aug 15:41:22.080 * Running mode=standalone, port=6379.
db_1 | The database cluster will be initialized with locale "en_US.utf8".
api_1 | [1/4] Resolving packages...
redis_1 | 1:M 16 Aug 15:41:22.080 # WARNING: The TCP backlog setting of 511 can not be enforced because /proc/sys/net/core/somaxconn is set to the lower value o f 128.
db_1 | The default database encoding has accordingly been set to "UTF8".
redis_1 | 1:M 16 Aug 15:41:22.080 # Server initialized
api_1 | [2/4] Fetching packages...
db_1 | The default text search configuration will be set to "english".
redis_1 | 1:M 16 Aug 15:41:22.080 # WARNING you have Transparent Huge Pages (TH P) support enabled in your kernel. This will create latency and memory usage iss ues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/t ransparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disab led.
db_1 |
redis_1 | 1:M 16 Aug 15:41:22.080 * Ready to accept connections
db_1 | Data page checksums are disabled.
db_1 |
db_1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1 | creating subdirectories ... ok
db_1 | selecting default max_connections ... 100
db_1 | selecting default shared_buffers ... 128MB
db_1 | selecting dynamic shared memory implementation ... posix
db_1 | creating configuration files ... ok
db_1 | running bootstrap script ... ok
db_1 | performing post-bootstrap initialization ... No usable system locales were found.
db_1 | Use the option "--debug" to see details.
db_1 | sh: locale: not found
db_1 | ok
db_1 | syncing data to disk ...
db_1 | WARNING: enabling "trust" authentication for local connections
db_1 | You can change this by editing pg_hba.conf or using the option -A, or
db_1 | --auth-local and --auth-host, the next time you run initdb.
db_1 | ok
db_1 |
db_1 | Success. You can now start the database server using:
db_1 |
db_1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1 |
db_1 | ****************************************************
db_1 | WARNING: No password has been set for the database.
db_1 | This will allow anyone with access to the
db_1 | Postgres port to access your database. In
db_1 | Docker's default configuration, this is
db_1 | effectively any other container on the same
db_1 | system.
db_1 |
db_1 | Use "-e POSTGRES_PASSWORD=password" to set
db_1 | it in "docker run".
db_1 | ****************************************************
db_1 | waiting for server to start....LOG: could not bind IPv6 socket: Addr ess not available
db_1 | HINT: Is another postmaster already running on port 5432? If not, wa it a few seconds and retry.
db_1 | LOG: database system was shut down at 2017-08-16 15:42:02 UTC
db_1 | LOG: MultiXact member wraparound protections are now enabled
db_1 | LOG: database system is ready to accept connections
db_1 | LOG: autovacuum launcher started
db_1 | done
db_1 | server started
db_1 | ALTER ROLE
db_1 |
db_1 |
db_1 | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initd b.d/initdb.sh
db_1 | /docker-entrypoint-initdb.d/initdb.sh: line 2: $'\r': command not fou nd
exampleapi_db_1 exited with code 127
api_1 | warning [email protected]: The platform "linux" is incompatible with thi s module.
api_1 | info "[email protected]" is an optional dependency and failed compatibil ity check. Excluding it from installation.
api_1 | [3/4] Linking dependencies...
api_1 | [4/4] Building fresh packages...
api_1 | Done in 55.49s.
api_1 | Starting 'run'...
api_1 | Starting 'db-migrate'...
api_1 | Error: getaddrinfo EAI_AGAIN db:5432
api_1 | at Object._errnoException (util.js:1022:11)
api_1 | at errnoException (dns.js:58:15)
api_1 | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:95:26)
api_1 | Starting 'build'...
api_1 | src/DataLoaders.js -> build/DataLoaders.js
api_1 | src/app.js -> build/app.js
api_1 | src/db.js -> build/db.js
api_1 | src/email.js -> build/email.js
api_1 | src/passport.js -> build/passport.js
api_1 | src/redis.js -> build/redis.js
api_1 | src/server.js -> build/server.js
api_1 | src/routes/account.js -> build/routes/account.js
api_1 | src/schema/Comment.js -> build/schema/Comment.js
api_1 | src/schema/CommentType.js -> build/schema/CommentType.js
api_1 | src/schema/EmailType.js -> build/schema/EmailType.js
api_1 | src/schema/Node.js -> build/schema/Node.js
api_1 | src/schema/README.md -> build/schema/README.md
api_1 | src/schema/Story.js -> build/schema/Story.js
api_1 | src/schema/StoryType.js -> build/schema/StoryType.js
api_1 | src/schema/User.js -> build/schema/User.js
api_1 | src/schema/UserType.js -> build/schema/UserType.js
api_1 | src/schema/ValidationError.js -> build/schema/ValidationError.js
api_1 | src/schema/index.js -> build/schema/index.js
api_1 | src/emails/welcome/html.hbs -> build/emails/welcome/html.js
api_1 | src/emails/welcome/subject.hbs -> build/emails/welcome/subject.js
api_1 | Finished 'build' after 1010ms
api_1 | Node.js API server is listening on http://api:8080/


$ winpty docker-compose exec api yarn db-seed
yarn db-seed v0.27.5
$ node tools/db.js seed
Starting 'db-seed'...
Error: getaddrinfo EAI_AGAIN db:5432
at Object._errnoException (util.js:1022:11)
at errnoException (dns.js:58:15)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:95:26)
Done in 26.30s.


$ docker-compose down
Stopping exampleapi_nginx_1 ...
Stopping exampleapi_nginx_1 ... done
Stopping exampleapi_api_1 ... done
exampleapi_nginx_1 exited with code 0
exampleapi_api_1 exited with code 0
redis_1 | 1:signal-handler (1502898486) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 16 Aug 15:48:07.046 # User requested shutdown...
redis_1 | 1:M 16 Aug 15:48:07.046 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 16 Aug 15:48:07.074 * DB saved on disk
Stopping exampleapi_redis_1 ... done
exampleapi_redis_1 exited with code 0
Removing exampleapi_nginx_1 ... done
Removing exampleapi_api_1 ... done
Removing exampleapi_db_1 ... done
Removing exampleapi_redis_1 ... done
Removing network exampleapi_default


$ docker-compose up
Creating network "exampleapi_default" with the default driver
Creating exampleapi_redis_1 ...
Creating exampleapi_db_1 ...
Creating exampleapi_db_1
Creating exampleapi_redis_1 ... done
Creating exampleapi_api_1 ...
Creating exampleapi_api_1 ... done
Creating exampleapi_nginx_1 ...
Creating exampleapi_nginx_1 ... done
Attaching to exampleapi_db_1, exampleapi_redis_1, exampleapi_api_1, exampleapi_nginx_1
db_1 | LOG: database system was interrupted; last known up at 2017-08-16 15:42:07 UTC
db_1 | LOG: database system was not properly shut down; automatic recovery in progress
db_1 | LOG: redo starts at 0/14EDC10
redis_1 | 1:C 16 Aug 15:48:31.164 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
db_1 | LOG: invalid record length at 0/14EDDF0: wanted 24, got 0
redis_1 | 1:C 16 Aug 15:48:31.164 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=1, just started
db_1 | LOG: redo done at 0/14EDDC8
redis_1 | 1:C 16 Aug 15:48:31.164 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
db_1 | LOG: last completed transaction was at log time 2017-08-16 15:42:07.984983+00
redis_1 | 1:M 16 Aug 15:48:31.166 * Running mode=standalone, port=6379.
db_1 | LOG: MultiXact member wraparound protections are now enabled
redis_1 | 1:M 16 Aug 15:48:31.166 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
db_1 | LOG: database system is ready to accept connections
redis_1 | 1:M 16 Aug 15:48:31.166 # Server initialized
redis_1 | 1:M 16 Aug 15:48:31.166 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
db_1 | LOG: autovacuum launcher started
redis_1 | 1:M 16 Aug 15:48:31.166 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 16 Aug 15:48:31.166 * Ready to accept connections
api_1 | Starting 'run'...
api_1 | Starting 'db-migrate'...
db_1 | FATAL: database "dev" does not exist
db_1 | FATAL: database "dev" does not exist
db_1 | FATAL: database "dev" does not exist
api_1 | error: database "dev" does not exist
api_1 | at Connection.parseE (/usr/src/app/node_modules/pg/lib/connection.js:546:11)
api_1 | at Connection.parseMessage (/usr/src/app/node_modules/pg/lib/connection.js:371:19)
api_1 | at Socket. (/usr/src/app/node_modules/pg/lib/connection.js:114:22)
api_1 | at emitOne (events.js:115:13)
api_1 | at Socket.emit (events.js:210:7)
api_1 | at addChunk (_stream_readable.js:252:12)
api_1 | at readableAddChunk (_stream_readable.js:239:11)
api_1 | at Socket.Readable.push (_stream_readable.js:197:10)
api_1 | at TCP.onread (net.js:589:20)
api_1 | Starting 'build'...
api_1 | src/DataLoaders.js -> build/DataLoaders.js
api_1 | src/app.js -> build/app.js
api_1 | src/db.js -> build/db.js
api_1 | src/email.js -> build/email.js
api_1 | src/passport.js -> build/passport.js
api_1 | src/redis.js -> build/redis.js
api_1 | src/server.js -> build/server.js
api_1 | src/routes/account.js -> build/routes/account.js
api_1 | src/schema/Comment.js -> build/schema/Comment.js
api_1 | src/schema/CommentType.js -> build/schema/CommentType.js
api_1 | src/schema/EmailType.js -> build/schema/EmailType.js
api_1 | src/schema/Node.js -> build/schema/Node.js
api_1 | src/schema/README.md -> build/schema/README.md
api_1 | src/schema/Story.js -> build/schema/Story.js
api_1 | src/schema/StoryType.js -> build/schema/StoryType.js
api_1 | src/schema/User.js -> build/schema/User.js
api_1 | src/schema/UserType.js -> build/schema/UserType.js
api_1 | src/schema/ValidationError.js -> build/schema/ValidationError.js
api_1 | src/schema/index.js -> build/schema/index.js
api_1 | src/emails/welcome/html.hbs -> build/emails/welcome/html.js
api_1 | src/emails/welcome/subject.hbs -> build/emails/welcome/subject.js
api_1 | Finished 'build' after 1146ms
api_1 | Node.js API server is listening on http://api:8080/
db_1 | FATAL: database "dev" does not exist
db_1 | FATAL: database "dev" does not exist

Permission denied when running docker-compose run api yarn

This is a possibly a Windows 10 bug and sorry because my understanding of Docker is not too well.

When I run docker-compose run --rm --no-deps api yarn in CMD it gives the following output:

yarn install v1.1.0                                                                                                                                                                                                                                      

[1/4] Resolving packages...                                                                                                                                                                                                                                  

[2/4] Fetching packages...                                                                                                                                                                                                                                   

info [email protected]: The platform "linux" is incompatible with this module.                                                                                                                                                                                  

info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.                                                                                                                                              [3/4] 

Linking dependencies...                                                                                                                                                                                                                                

error Could not write file "/usr/src/app/yarn-error.log": "EACCES: permission denied, open '/usr/src/app/yarn-error.log'"                                                                                                                                    

error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/src/app/node_modules'".                                                                                                                                                          
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

So I'm guessing this command runs yarn inside the docker container to download all the node_modules into the container, tries to do some logging because it does not have permission to make the node_modules directory. I haven't figured out how it knows to do all that because when I comment out both Dockerfiles the same thing happens and there's no sign of yarn under api in the docker-compose.yml file.

Any help will be greatly appreciated 😭 😭 😭

emails table problem

Using aaa3d71, I notice after initializing with docker that no email table is added to db dev

dev=# \dt
              List of relations
 Schema |      Name       | Type  |  Owner   
--------+-----------------+-------+----------
 public | comment_points  | table | postgres
 public | comments        | table | postgres
 public | logins          | table | postgres
 public | migrations      | table | postgres
 public | migrations_lock | table | postgres
 public | stories         | table | postgres
 public | story_points    | table | postgres
 public | users           | table | postgres

...so when I seed the database, I get

Starting 'db-seed'...
error: relation "emails" does not exist
    at Connection.parseE (/usr/src/app/node_modules/pg/lib/connection.js:546:11)
    ...

Relatedly, this problem was causing errors at src/passport, line 80

db_1     | ERROR:  relation "emails" does not exist at character 13
db_1     | STATEMENT:  insert into "emails" ("email", "user_id", "verified") values ($1, $2, $3)

Data from External ReST API

From the README, it seems fairly straightforward to implement connections to multiple data stores. How would I go about it, if one (or more) of my data sources were not direct access to the DB, but through an external ReST API?

docker-compose up fails when run on a docker version 1.7 up of installed through docker toolbox on win 7

~ docker-compose up
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose\cli\main.py", line 68, in main
  File "compose\cli\main.py", line 118, in perform_command
  File "compose\cli\main.py", line 928, in up
  File "compose\project.py", line 414, in up
  File "compose\project.py", line 640, in warn_for_swarm_mode
  File "site-packages\docker\api\daemon.py", line 90, in info
  File "site-packages\docker\utils\decorators.py", line 46, in inner
  File "site-packages\docker\api\client.py", line 189, in _get
  File "site-packages\requests\sessions.py", line 488, in get
  File "site-packages\requests\sessions.py", line 475, in request
  File "site-packages\requests\sessions.py", line 596, in send
  File "site-packages\requests\adapters.py", line 423, in send
  File "site-packages\requests\packages\urllib3\connectionpool.py", line 595, in urlopen
  File "site-packages\requests\packages\urllib3\connectionpool.py", line 363, in _make_request
  File "httplib.py", line 1042, in request
  File "httplib.py", line 1082, in _send_request
  File "httplib.py", line 1038, in endheaders
  File "httplib.py", line 882, in _send_output
  File "httplib.py", line 844, in send
  File "site-packages\docker\transport\npipeconn.py", line 31, in connect
  File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
  File "site-packages\docker\transport\npipesocket.py", line 50, in connect
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')
Failed to execute script docker-compose

Cannot start service api on Mac OS Sierra

Hi, after running docker-compose up I get the following error.
It seems like a directory is not existing in the container.

WARNING: The CI variable is not set. Defaulting to a blank string.
nodejsapistarter_redis_1 is up-to-date
nodejsapistarter_db_1 is up-to-date
Starting nodejsapistarter_api_1 ... 
Starting nodejsapistarter_api_1 ... error

ERROR: for nodejsapistarter_api_1  Cannot start service api: oci runtime error: container_linux.go:265: starting container process caused "process_linux.go:368: container init caused \"rootfs_linux.go:57: mounting \\\"/Users/js/nodejs-api-starter/yarn.lock\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b0cb450d16003e66779586c0c94a4bd633b32c6a794c5ca7da70257556c17e7d\\\" at \\\"/var/lib/docker/aufs/mnt/b0cb450d16003e66779586c0c94a4bd633b32c6a794c5ca7da70257556c17e7d/usr/src/app/yarn.lock\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for api  Cannot start service api: oci runtime error: container_linux.go:265: starting container process caused "process_linux.go:368: container init caused \"rootfs_linux.go:57: mounting \\\"/Users/js/nodejs-api-starter/yarn.lock\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b0cb450d16003e66779586c0c94a4bd633b32c6a794c5ca7da70257556c17e7d\\\" at \\\"/var/lib/docker/aufs/mnt/b0cb450d16003e66779586c0c94a4bd633b32c6a794c5ca7da70257556c17e7d/usr/src/app/yarn.lock\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

docker-compose permission errors in Ubuntu 16.04

Setup:

  • Ubuntu 16.04.02 (xenial)
  • docker-compose version 1.11.2
  • Docker version 17.06.0-ce

After docker-compose up, get positive results until api build stage:

api_1    | warning [email protected]: The platform "linux" is incompatible with this module.
api_1    | info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from instal
lation.
api_1    | [3/4] Linking dependencies...
api_1    | error Could not write file "/usr/src/app/yarn-error.log": "EACCES: permission denied, open '/usr/src/app
/yarn-error.log'"
api_1    | error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/src/app/node_modules/accepts
'".
api_1    | info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
api_1    | module.js:487
api_1    |     throw err;
api_1    |     ^
api_1    | 
api_1    | Error: Cannot find module 'rimraf'
api_1    |     at Function.Module._resolveFilename (module.js:485:15)
api_1    |     at Function.Module._load (module.js:437:25)
api_1    |     at Module.require (module.js:513:17)
api_1    |     at require (internal/module.js:11:18)
api_1    |     at Object.<anonymous> (/usr/src/app/tools/build.js:13:16)
api_1    |     at Module._compile (module.js:569:30)
api_1    |     at Object.Module._extensions..js (module.js:580:10)
api_1    |     at Module.load (module.js:503:32)
api_1    |     at tryModuleLoad (module.js:466:12)
api_1    |     at Function.Module._load (module.js:458:3)

Thanks, G

napi and sodium integration issue

New project from master generates error on yarn install on osx

nodejs-api-starter/node_modules/node-addon-api/napi.h:6:10: fatal error: 'initializer_list' file not found
#include <initializer_list>

If I add missing config into binding.gyp

      "defines": ["NAPI_CPP_EXCEPTIONS"],
      "xcode_settings": {
        "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
        "CLANG_CXX_LIBRARY": "libc++",
        "MACOSX_DEPLOYMENT_TARGET": "10.7",
      },
      "msvs_settings": {
        "VCCLCompilerTool": { "ExceptionHandling": 1 },
      },

It still requires missing module

/src/utils/password_hash.cc:2:10: fatal error: 'sodium.h' file not found

Running yarn docker-test does not work

Hi, I'm very happy with this repo and the way it has built-in docker based architecture which I'm learning atm. I got such error today:

Error message:

Starting nodejsapistarter_redis_1 ... done
Starting nodejsapistarter_db_1 ... done
yarn run v1.3.2                                                                
$ jest                                                                         
/bin/sh: jest: not found
error Command failed with exit code 127.

Steps to reproduce:

  1. Clone the repo
  2. Run yarn docker-test

I can make a pull request fixing this.

Digital Ocean (Ubuntu 16.04) node/tools publish deployment fails

  1. I confirm that a toy docker-compose application can be deployed to a new Ubuntu 16.04 droplet by installing docker-compose deps and executing the steps at how-to-install-wordpress-and-phpmyadmin-with-docker-compose-on-ubuntu-14-04.

  2. Install Node LTS (6.11) on 16.04 droplet.

  3. Attempt to recover the hostname cat /etc/hostname (no ~/.ssh/config found).

  4. Following Deployment, execute node tools/publish <host> using name from 3).

Get different errors, for example, the following:

  • EACCESS related to yarn
  • Permission denied (publickey)

So, seems to turn on a remote server configuration issue, namely, ~/.ssh/config. I grant that this is somewhat a side-issue, but any comment in a reply to this issue would be appreciated.

Separately, on the same droplet as above docker-compose up hangs for a while and then reports an error:

api_1    | Finished 'build' after 2588ms
api_1    | events.js:182
api_1    |       throw er; // Unhandled 'error' event
api_1    |       ^
api_1    | 
api_1    | Error: read ECONNRESET
api_1    |     at exports._errnoException (util.js:1016:11)
api_1    |     at Pipe.onread (net.js:609:25)

Edit: Alternatively, confirm which remote server deploy scenario has succeeded, for example, AWS, which we can take as a default approach.

Error: Cannot find module 'del'

$ docker-compose up

Error: Cannot find module 'del'
api_1 | at Function.Module._resolveFilename (module.js:536:15)
api_1 | at Function.Module._load (module.js:466:25)
api_1 | at Module.require (module.js:579:17)
api_1 | at require (internal/module.js:11:18)
api_1 | at Object. (/usr/src/app/tools/build.js:11:13)
api_1 | at Module._compile (module.js:635:30)
api_1 | at Object.Module._extensions..js (module.js:646:10)
api_1 | at Module.load (module.js:554:32)
api_1 | at tryModuleLoad (module.js:497:12)
api_1 | at Function.Module._load (module.js:489:3)
exampleapi_api_1 exited with code 1

Using with bcrypt get failed to fetch error

I don't know why but when i call bcrypt methods in mutation even just for logging i get error. I testing in graphiql. Bcrypt last version. I tested ON seperate file bcrypt. It works fine.

docker-compose taking forever to boot up containers

Hi,

so following your step-by-step instructions in the readme, when I run docker-compose for a second time in the project it can take a minute or more to boot up!

Example of it taking over a minute when i gave up:
screenshot 2017-02-27 17 30 17

Was not the case when i first pulled it and ran the command the first time.

Clean up the output directory on build

Add one more step to run.js/tasks.set('build', () => ...), so that when you run node run build it would clean up the output (build) directory before copying any files.

Hint: use rimraf module, e.g. .then(() => new Promise(resolve => rimraf(.., resolve))).

Why in read-only mode for databases?

If the databases are read-only, how do you suppose even the init scripts to work? Even on production, why would you have your databases read-only?

node tools/db version command not working

$ node tools/db.js version
Starting 'db:version'...
TypeError: Cannot read property 'hasTable' of undefined
at Migrator._ensureTable (/usr/src/app/node_modules/knex/lib/migrate/index.js:248:22)
at Migrator._listCompleted (/usr/src/app/node_modules/knex/lib/migrate/index.js:391:17)
at Migrator.currentVersion (/usr/src/app/node_modules/knex/lib/migrate/index.js:177:17)
at module.exports.task (/usr/src/app/tools/db.js:44:26)
at Promise.resolve.then (/usr/src/app/tools/task.js:23:39)
at
at process._tickCallback (internal/process/next_tick.js:169:7)
at Function.Module.runMain (module.js:607:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
Done in 2.61s.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Deployment to Heroku

Not clear how to deploy an app to heroku, we've tried this node tools/publish # where is the name of your web server (see ~/.ssh/config) but we are not quite sure what the host name is for a heroku app. Could you please guide us?

The steps followed were to pass an IP obtained from running this ssh -v [email protected] as well as the name of the app.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

DigitalOcean: Docker Run / yarn deploy not working?

I have setup and deployed an image onto the Docker hub.

I have a DigitalOcean instance running with docker installed and can pull in the latest image.

Whenever I run docker run <repo> I am getting the error Cannot find module 'source-map-support'

Am I supposed to be running the image in a different way?

I tried deploying via node tools/publish <host> and received this error as well:

ERROR: for app_api_1 Cannot start service api: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/usr/src/app/yarn.lock\\\" to rootfs \\\"/var/lib/docker/overlay2/6e6c2ca99741b1caee00123a6b30955444eb086996fca30456cb2bdeabf6198f/merged\\\" at \\\"/var/lib/docker/overlay2/6e6c2ca99741b1caee00123a6b30955444eb086996fca30456cb2bdeabf6198f/merged/usr/src/app/yarn.lock\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Edit: When running the deploy tool, it seems to convert the yarn.lock file to a directory... Am I missing something here? I took a look at the tools/publish.js file and followed the directions. I don't see anything in there that would generate the files as directories.

Edit2: Just tried deploying with a fresh copy of the project
put the docker-compose.yml file in /usr/src/app directory like the docks say. Received the same error when running the deploy script

Any help would be great!

Log SQL queries in development mode

It would be nice to see all the SQL queries sent to the server printed to standard Docker output (in development mode only).

More info:

Note: The config/postgres-initdb.sh file is being executed inside the db service only when data volume is missing while creating a new database from scratch.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Npm packages not available

Due to :
https://github.com/npm/registry/issues/255

[2/4] Fetching packages...
api_1 | error An unexpected error occurred: "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.1.tgz: Request failed "404 Not Found"".
api_1 | info If you think this is a bug, please open a bug report with the information provided in "/usr/src/app/yarn-error.log".
api_1 | info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Can we somehow cache it somewhere just in case some packages gone again?

ACL managing

I would like to bring to the table discussion about managing ACL permissions. After reading multiple resources I still can't realize what would be an optimal solution for managing permissions. As somebody noticed there're two main pain points .pre and .post permission manging. What do you think about possible approaches to implement it to the starter?

no entry file inside docker image

Docker can't find server.js file inside the image. The way to reproduce:

$ node tools/publish.js foobar
$ docker run -p 8080:8080 api

response:

Error: Cannot find module '/usr/src/app/build/server.js'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:453:25)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:201:16)
    at bootstrap_node.js:626:3

Would you consider creating this but without docker?

I see a lot of people have had trouble setting up docker especially those who have Windows machines, is it possible to create a similar repository but without the docker component, even if it is not updated regularly I think it would still be extremely beneficial.

Cheers! 🌮

Instructions on hooking up to react-starter-kit

Hi there,

I recently cloned react-starter-kit from kriasoft and already started to build out my front-end with it. One thing I'd really love to do is use this nodejs-api-starter to communicate with the react-starter-kit, although I'm unsure of where to go. Most likely I'd need to modify the nginx proxy_pass, but need a little push in the right direction.

For now my workflow looks like: yarn start on react-starter-kit in one tab, and then docker-compose up -d in another tab which starts the API server.

My goal is to be able to build out all my REST endpoints on with the nodejs-api-starter and have my client talk to the react-starter-kit.

FWIW, I'm running react-starter-kit on port 3001 and the nodejs-api-starter runs on 8080.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Tutorial request

I'd really like to see a nice tutorial explaining how to build this starter from scratch. A starter is all very well until you need to modify it and have no idea why anything was done in the way it was done.

Obviously this is a huge ask but I wanted to put it out there in case there was someone who both could and wants to do this.

Live Reload Not Working

Hi,

Live Reload not working on MacOs

Volume mounting is working fine and the changes are getting copied over.

ERROR: for postgres Cannot create container for service postgres: Invalid bind mount spec

I get this error on my windows machine when trying to run docker-compose up

ERROR: for postgres  Cannot create container for service postgres: Invalid bind mount spec "C:\\playground\\example-api\\scripts\\postgres-init.sh:/docker-entrypoint-initdb.d/init.sh:rw": Invalid volume specification: 'C:\playground\example-api\scripts\postgres-init.sh:/docker-entrypoint-initdb.d/init.sh:rw'
ERROR�: Encountered errors while bringing up the project.

Add "Local" authentication strategy

We need to support the scenario when a website user can click [Sign In], enter his or her email address, click [Next].. The server must send an email with a temporary pass code and/or URL link; user clicks on the link or enters the code on the next screen of the login page and thus authenticates himself (no need to remember a password).

The list of Passport.js authentication strategies can be found in src/passport.js and the list of login options such as www.example.com/login/facebook is located in src/routes/account.js.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

App seems to boot up, but can't access

Hey! Brand new to docker.

Running:

  • MacOS High Sierra 10.13.3 (17D47)
  • Completely unmodified clone of the latest version of this repo
  • Docker version 18.04.0-ce, build 3d479c0
  • docker-compose version 1.21.2, build unknown

When I run docker-compose up, everything seems to execute successfully, and I arrive at this line:

api_1    | Finished 'build' after 1811ms
api_1    | Node.js API server is listening on http://api:8080/

But when I try to access it through chrome in my browser - http://localhost:8080/ - I don't get anything. Not sure what to do next, or where I'm messing up.

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.