kriasoft / relay-starter-kit Goto Github PK
View Code? Open in Web Editor NEW💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, and Joy UI.
Home Page: https://graphqlstart.com
License: MIT License
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, and Joy UI.
Home Page: https://graphqlstart.com
License: MIT License
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?
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.
Integrate connect-redis
as a storage provider for express-session
used in the project.
You can find Express middlewares in the src/app.js
file, Redis configuration is located in docker-compose.yml
and environment variables are located in .env.example
file.
Ref "Stop using JWT for sessions" by @joepie91
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)
File to edit migrations/201612010000_initial.js
https://www.postgresql.org/docs/current/static/datatype-json.html#JSON-INDEXING
http://knexjs.org/#Schema-index
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Setup:
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
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)?
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
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 😭 😭 😭
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:
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
Try to seed databases in spite of error from above step.
winpty docker-compose exec api yarn db-seed
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
This
http://join-monster.readthedocs.io/en/latest/
best regards
I figure out the question.
~ 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
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.
Install Node LTS (6.11) on 16.04 droplet.
Attempt to recover the hostname cat /etc/hostname
(no ~/.ssh/config
found).
Following Deployment, execute node tools/publish <host>
using name from 3).
Get different errors, for example, the following:
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.
Host OS : Windows 10
Solution was to connect to PostgreSQL and execute the following but I'm not too familiar with Docker to run it automatically while compose up.
CREATE EXTENSION "uuid-ossp";
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
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.
$ 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.
$ 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
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:
I can make a pull request fixing this.
Hey! Brand new to docker.
Running:
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.
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.
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)))
.
For example, Node.js v7.7 supports async/await natively, need to remove related plugins from the list. See .babelrc
.
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?
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! 🌮
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?
What do you think about replacing Passport.js/session-based authentication with Firebase authentication, which already supports phone verifications - 10K/month for free, password reset etc.
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.
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.
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
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?
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.
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!
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.
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.
/login/:provider/:returnURL?
and /login/:provider/return
routes/logout/:returnURL?
routeHi 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.
I see that unit tests are included, but I think adding some sample integration tests would also be helpful. Which could include using something like super test to send route requests.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I just clone the project and on the root of the project :
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)
Why its happening? Kind regards
https://prettier.github.io/prettier/
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
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
Hi,
Live Reload not working on MacOs
Volume mounting is working fine and the changes are getting copied over.
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.