Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 04 2017 11:19

    koistya on master

    Update 'pg' module: 7.0.2 > 7.1… (compare)

  • Aug 03 2017 10:21

    koistya on master

    Update "yarn lint" script (compare)

  • Aug 03 2017 10:14
    koistya edited #50
  • Aug 03 2017 10:13
    koistya edited #50
  • Aug 03 2017 10:12

    koistya on master

    Integrate Prettier (#50) (compare)

  • Aug 03 2017 10:12
    koistya closed #50
  • Aug 03 2017 10:06
    koistya synchronize #50
  • Aug 03 2017 10:04
    koistya synchronize #50
  • Aug 03 2017 09:57
    koistya synchronize #50
  • Aug 03 2017 08:35
    koistya synchronize #50
  • Aug 03 2017 08:07
    koistya synchronize #50
  • Aug 03 2017 07:54
    koistya edited #50
  • Aug 03 2017 07:53
    koistya edited #50
  • Aug 03 2017 07:52
    koistya edited #50
  • Aug 03 2017 07:52
    koistya opened #50
  • Aug 02 2017 19:09

    koistya on master

    Add Circle CI config (#49) (compare)

  • Aug 02 2017 19:09
    koistya closed #49
  • Aug 02 2017 19:08
    koistya edited #49
  • Aug 02 2017 19:06
    koistya synchronize #49
  • Aug 02 2017 19:02
    koistya synchronize #49
Davey
@DaveyEdwards

Is there anything new to do with getting GCP to work? I am getting the grpc errors again when trying to

docker-compose run --rm --no-deps api yarn

I put back the libsodium-dev and libc6-compat in
Dockerfile.dev

RUN apk add --no-cache make g++ python2 libsodium-dev libc6-compat && \
  npm install -g node-gyp && \
  mkdir -p /home/node/.cache/yarn && \
  ...

Dockerfile

RUN set -ex; \
  if [ "$NODE_ENV" = "production" ]; then \
  yarn install --no-cache libsodium libc6-compat --frozen-lockfile --production; \
  elif [ "$NODE_ENV" = "test" ]; then \
  touch yarn-error.log; \
  mkdir -m 777 build; \
  yarn install --no-cache libsodium libc6-compat --frozen-lockfile; \
  chown -R node:node build node_modules package.json yarn.lock yarn-error.log; \
  else \
  touch yarn-error.log; \
  mkdir -p -m 777 build node_modules /home/node/.cache/yarn; \
  chown -R node:node build node_modules package.json yarn.lock yarn-error.log /home/node/.cache/yarn; \
  fi;

Error

error /usr/src/app/node_modules/grpc: Command failed.
Exit code: 1
Command: ./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library
Arguments:
Directory: /usr/src/app/node_modules/grpc
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.39
node-pre-gyp info using node@8.9.1 | linux | x64
node-pre-gyp info check checked for "/usr/src/app/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-musl/grpc_node.node" (not found)
node-pre-gyp http GET https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.7.2/node-v57-linux-x64-musl.tar.gz
node-pre-gyp http 403 https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.7.2/node-v57-linux-x64-musl.tar.gz
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.7.2/node-v57-linux-x64-musl.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.7.2 and node@8.9.1 (node-v57 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.7.2/node-v57-linux-x64-musl.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.9.1 | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.9.1 | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.9.49-moby
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/usr/src/app/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-musl/grpc_node.node" "--module_name=grpc_node" "--module_path=/usr/src/app/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-musl"
gyp ERR! cwd /usr/src/app/node_modules/grpc
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configu
Konstantin Tarkus
@koistya
@DaveyEdwards it's a known issue with grpc module on Alpine. As a workaround, you can use Ubuntu-based "node" image for now until the next version of "grpc".
Tulsi Leathers
@tulsileathers

@koistya you said this earlier

@jayce-leathers you may want to create a migration file similarly to migrations/initial.js where you would describe your db schema. This way it would be under the source control. To migrate actual db to the new schema you would run docker-compose exec api yarn db-migrate (assuming the app is already running)

I've made a migration for the table I want to import. How would I actually import my dump.sql file created with pg_dump?

Tulsi Leathers
@tulsileathers
am I going to have problems with the postgres container being declared as readonly? I would like to move the data backup from my local postgres instance into the docker instance. Then write it to that volume. I then want to be able to deploy that volume, probably to digital ocean. Any recommendations for tools that make managing data volumes easy? I've heard of flocker and convoy but haven't tried either yet
Davey
@DaveyEdwards
to fix the grpc is it not the same as the last times fix of adding libsodium libc6-compat to the install lines of dockerfile/dockerfile.dev? The one big difference of the update was the line in the Dockerfile starting with RUN. I tried a few variations with trying to get something like this to work
RUN apk add --no-cache libsodium libc6-compat; \
  set -ex; \
  if [ "$NODE_ENV" = "production" ]; then \
Konstantin Tarkus
@koistya
@jayce-leathers after launching the app "docker-compose up", you can connect to the database from you host machine as usual (e.g. run pg_dump on it), the port is exposed here https://github.com/kriasoft/nodejs-api-starter/blob/master/docker-compose.yml#L60
Konstantin Tarkus
@koistya
@DaveyEdwards you would need to replace FROM node:8.9.1-alpine to FROM node:8.9.1 until the next version of grpc
Gallagher Polyn
@gpolyn
@koistya you removed NGINX with c8381dddd4, but I'd like to use it, now, and add SSL to it. Can you suggest (link) me to guidance on SSL + nodejs-api-starter?
Konstantin Tarkus
@koistya
@gpolyn I would recommend using CloudFlare over your API, it's better for privacy (you don't expose your actual IP address), also it has DDoS protection and a whole bunch of other nice features. There is FREE tier. You won't need to care about setting up SSL manually. All you need to do is to configure your app to trust (proxy) requests from CloudFlare IPs. See https://www.npmjs.com/package/cloudflare-ips
@gpolyn if you still want your own SSL, there are some great tutorials at DigitalOcean website
Gallagher Polyn
@gpolyn
@koistya thanks. I was wondering why you ditched NGINX -- I assume it's the CloudFlare bit. As always, you are prompt to respond and I really appreciate it.
Konstantin Tarkus
@koistya
@gpolyn yeah, that was the reason. No need to worry about SSL and it works great, many folks are using it (e.g. Medium.com etc.) Another reason was that if you would host your app in Amazon ECS or Google Cloud, Azure (using Kubernetes) - most likely you would use an existing reverse proxy instead of Nginx that comes with those container management setups.
Gallagher Polyn
@gpolyn
@koistya hmmm, looks like I could use a little more hand-holding here. Tried the cloudflare-ips + Cloudflare + api-starter (old NGINX version) and got an error on the server side. Can you confirm 1) I should be able to sneak cloudflare-ips into the NGINX version or 2) how it is used with the current version?
Gallagher Polyn
@gpolyn
@koistya ...tried to give the attempt a full follow-through, steps follow. 0) Prepare CloudFlare DNS, including with 'Full" SSL, 1) prepare cloud instance, 2) clone nodejs-api-starter, 3) open port 80 in compose file, 3) dupe directions at cloudflare-ips at src/server, 4) raise with docker-compose, 5) confirm http traffic allowed at domain name, 6) FAIL confirmation https traffic. Maybe there is delay in my SSL certification (+6 hours). Anyway, have you any references, directions to share?
...maybe the gap is I haven't yet inserted a reverse proxy (Google Cloud instance).
Gallagher Polyn
@gpolyn
@koistya tempest in a teapot: use the Cloudflare > Crpto > SSL: 'Flexible' setting, when not using origin certificates. So, I think I've got it, now, thanks. (BTW: I got an error following cloudflare-ips README guidance unless I added default IPS vals... cloudflareIPs((err, ips=[]) => { app.set('trust proxy', ['loopback', ...ips]); });
Davey
@DaveyEdwards
if anyone is wondering how to setup VS Code debugging for this project I made some instructions on how to do it https://github.com/MyiWorlds/myiworlds.backend/wiki/Enabling-VS-Code-Debugging
Konstantin Tarkus
@koistya
@gpolyn are you using Nginx? If so, it may block forwarded IP/port.. you would need to tweak nginx settings to pass them through
alaaalshaikh
@aalshaikh
HI i am trying to add new table in database and i edit 201612010000_initial.js and add new table like this
await db.schema.createTable('events', table => {
table.uuid('id').notNullable().defaultTo(db.raw('uuid_generate_v1mc()')).primary();
table.uuid('user_id').notNullable().references('id').inTable('users').onDelete('CASCADE').onUpdate('CASCADE');
table.text('text');
table.timestamps(false, true);
});
and then run yarn docker-db-migrate
but the database not updated with new table
i am doing it right?
Holger Selover-Stephan
@shadowbrush
@aalshaikh : each db schema change requires a new migration file. You can manually create a file in the same directory as the initial one, or run knex migrate:make migration_name. Then add the up and down code and restart the container.
alaaalshaikh
@aalshaikh
@shadowbrush oh great i will check it thanks
Konstantin Tarkus
@koistya
@aalshaikh before you deployed your app to production, it's convinient to edit the existing migration, you would just need to re-apply it by running yarn db-rollback && yarn db-migrate from inside the api container
Ifemide
@bwoodlt
How do you pass parameters inside the email template?
Holger Selover-Stephan
@shadowbrush
@bwoodlt you pass them as attributes to the context param: https://github.com/kriasoft/nodejs-api-starter/blob/master/src/email.js#L60 . Then use them in the template with the double curlies, such as {{userName}}.
Ifemide
@bwoodlt
thanks @shadowbrush all sorted now
monotv
@monotv
Guys, are we supposed to execute ‘npm install’ in the project directory? because else the dev dependencies like the eslint plugins are not available. Just asking because it is not mentioned in the readme.
Holger Selover-Stephan
@shadowbrush
Yes, I ran yarn install.
monotv
@monotv
cheers
ntaboada
@ntaboada
Hi people
can someone help me_
i am not able to get the repo working
Joshua Manns
@joshuamanns
@koistya Good day! Why does https://github.com/kriasoft/nodejs-api-starter/blob/3612dc4c6f6a226d10f3d6765e1d0af797c57127/Dockerfile#L22 enumerate all the files rather than doing something like chown -R node:node * ? I'm asking more out of curiosity than suggestion
Konstantin Tarkus
@koistya
@joshuamanns thanks for heads up, it would be nice to change that to your shorter syntax. A pull request is welcome
Aggro
@AggroGG_twitter
Hey guys, having an issue getting the API starterkit working on Windows 7 - getting the following error running docker-compose up
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 \\"/d/Development/Request/example-api/yarn.lock\\" to rootfs \\"/mnt/sda1/var/lib/docker/aufs/mnt/1be37fc2c8bfdeedc57eadeb84e1e63a1cbfaf840250056b8f3c3f890271e5dd\\" at \\"/mnt/sda1/var/lib/docker/aufs/mnt/1be37fc2c8bfdeedc57eadeb84e1e63a1cbfaf840250056b8f3c3f890271e5dd/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
ERROR: Encountered errors while bringing up the project.
Running via the Docker Quickstart Terminal
Alternatively, does anyone have a version that isn't running via Docker?
Aggro
@AggroGG_twitter
Okay, I've managed to figure out the issue - I had to place the code under my /users/ directory - the issue was the drive wasn't shared in Docker - I couldn't figure out how to share my D:/ drive via CMD so I just moved the code, that fixed the issue.
Nizar Ayari
@nizarayari
Hi there!
Anyone has a gist for local authentication working with the starter kit?
Maybe something using jwt would great
Thanks
Darrin Dickey
@darrindickey
@koistya Struggling with db-migrate function. I was getting an "Unable to acquire connection" error. I had to hardcode the postgres db address to db.js and tools/db.js files. Now, when I run yarn db-migrrate, I get: Error: getaddrinfo ENOTFOUND db db:5432. My db is accessible at DATABASE_URL=postgres://postgres@db:5432/dev. I can access it via query, mutation, db-migration, etc. Any suggestions?
chakshu gautam
@chaks03_gitlab
Is there some config I can use for auto deploy to digital ocean?
Or some starting point where I can study about it?
I currently deploy every time I push to production.