Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Mark Terrel
    @mterrel
    • I can also start working on adding the option to LocalNodeImage so you can use it. Let me know if you need this quickly and I'll get working on it.
    • Or, if you'd like to submit a PR that updates LocalNodeImage to take a prop for its image, that would be awesome.
    Mark Terrel
    @mterrel

    I'm guessing that your third question is also about LocalNodeImage. So the short answer is that it runs npm run build by default.

    But that actually is configurable. If you're using LocalNodeImage directly, you can control both which package manager to use (npm is default) and what scripts to run. Here's an example:

    <LocalNodeImage srcDir="../frontend"  options={{ packageManager: "yarn" runNpmScripts: [ "setup", "build" ] }} />
    You can check out some of these docs for more info:
    Mark Terrel
    @mterrel
    Oops, I just noticed there's a comma missing, just before runNpmScripts in the example above.
    Tarrence van As
    @tarrencev
    are there any examples of deploying an application to gcloud and serving over an https endpoint?
    Mark Terrel
    @mterrel
    Hi @tarrencev ! We have an article that describes how to use GKE here: https://adaptjs.org/blog/2020/01/10/simple-hosting-react-app-on-google-cloud
    Let me know if that's not quite what you're looking for and we can help out.
    Tarrence van As
    @tarrencev
    taking a look now, thanks!
    Mark Terrel
    @mterrel
    No problem! Let me know if you have questions or need other help.
    Tarrence van As
    @tarrencev
    Is there a way to see more verbose logging during deploy? Seems i am stuck at ⠧ Deploying Docker image 'react-app' when building locally
    Tarrence van As
    @tarrencev
    I managed to get it working
    @mterrel i want to enable https for local development. is there a way to setup nginx to support this?
    Mark Terrel
    @mterrel
    Yes, there is logging, although it's not as great as we'd eventually like it to be. Currently, we use the Node.js debug module with the prefix adapt:. To see Docker related stuff during build:
    DEBUG=adapt:cloud:docker* adapt run ...
    That's the most verbose version of docker logging. Once you see the output, you can change the DEBUG= to show more or less stuff.
    If you really want a lot of output, use DEBUG=adapt*
    There isn't an existing example of setting up Nginx with HTTPS, but there definitely should be! If you'd like to contribute an example setup, that would be awesome. Either way though, we can help you get it set up if you'd like. There are Nginx components that should be a good starting point.
    Mark Terrel
    @mterrel
    If you'd like some help getting started with those, I can spend some time on it a little later in the day for you.
    But should be able to answer questions in the meantime too
    Tarrence van As
    @tarrencev
    @mterrel awesome i will take a look at that. hopefully last question. i have multiple servers listening in my node backend. how do i handle routing for this case? i.e. one server on 80 one on 90. i would like /api => 80 and /api2 => 90
    Mark Terrel
    @mterrel
    Ah, there's a UrlRouter component for that. The Nginx implementation of that component is here. And the getting started guide uses that component to route traffic for /api to an API backend service and routes everything else to a static HTTP server (also Nginx).
    To create a new adapt project that's a simple starting point that includes the UrlRouter: adapt new hello-react-node-postgres ./some_dir
    To see a slightly more full featured demo with it: adapt new moviedb-react-node ./some_other_dir
    Tarrence van As
    @tarrencev
    i see that. but if a single node instance is hosting two services it is unclear how to setup. if i do
    <NodeService port={80} handle={api} srcDir="../backend" />
    <NodeService port={90} handle={api2} srcDir="../backend" />
    would that create separate containers for each port?
    Mark Terrel
    @mterrel
    Yes, that would build two (identical) container images and run one of each.
    Hold on, lemme look at it for a sec...
    Mark Terrel
    @mterrel
    So in the UrlRouter routes prop, endpoint can be a string, so you could try to construct the right string URLs to put in there by using something like:
    const hostname = callInstanceMethod(api, undefined, "hostname");
    ...
    <UrlRouter port={8080} routes={[
      { path: "/api", endpoint: `http://${hostname}:80` },
      { path: "/api2", endpoint: `http://${hostname}:90` }
    ]} />
    I think that will work ok for local docker deploy. But in order to make it work in GKE, you'd need to copy and modify NodeService to allow it to take multiple ports to listen on so it correctly creates a NetworkService that corresponds to each of those also.
    Mark Terrel
    @mterrel
    And once again, if that's something you feel like you'd like to work on and contribute, that would be awesome. Or depending on how quickly you need it, we can probably get to doing it over the next few days.
    And maybe the dual NodeService can work for you in the short term?
    Tom Dyas
    @tdyas

    I'm getting a compile error when trying to run yarn build in the cloud/ directory:

    ~/Projects/Adapt/adapt/cloud$ yarn build
    yarn run v1.19.1
    $ tsc -p tsconfig.json
    src/aws/aws-sdk.ts:17:10 - error TS2305: Module '"../../../node_modules/@adpt/utils/dist/src"' has no exported member 'ciMaybeCreateLogger'.
    
    17 import { ciMaybeCreateLogger, ciReportEnabled, makeRetryDelay } from "@adpt/utils";
                ~~~~~~~~~~~~~~~~~~~
    
    src/aws/aws-sdk.ts:17:31 - error TS2305: Module '"../../../node_modules/@adpt/utils/dist/src"' has no exported member 'ciReportEnabled'.
    
    17 import { ciMaybeCreateLogger, ciReportEnabled, makeRetryDelay } from "@adpt/utils";
                                     ~~~~~~~~~~~~~~~
    
    src/aws/aws-sdk.ts:17:48 - error TS2305: Module '"../../../node_modules/@adpt/utils/dist/src"' has no exported member 'makeRetryDelay'.
    
    17 import { ciMaybeCreateLogger, ciReportEnabled, makeRetryDelay } from "@adpt/utils";
                                                      ~~~~~~~~~~~~~~
    
    
    Found 6 errors.
    
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

    This is off of master at cb497355477d9bf0887555fd0110854fa54d580c plus some changes to add some code into cloud/aws/.

    Mark Terrel
    @mterrel
    Hi @tdyas , There are two things that are the most likely causes. The first one may be environment, tool, or dependency related and can be diagnosed by changing to the top level adapt repo directory and trying make cleaner; make build. That will do a complete cleanup, then build everything from scratch, using the containerized dev environment instead of your local system's tools and environment. Generally speaking, you shouldn't build or test using your system's native tools and environment, but rather use the containerized version of those, which can be found in the bin directory at the top level of the adapt repo. So instead of running yarn build in the cloud directory, you'd run ../bin/yarn build. And by using make instead of directly calling yarn, that ensures that dependencies have definitely been correctly (re-)built.
    If that doesn't build successfully, can you stash your cloud/aws changes and try make cleaner; make build again? Then, let me know the results and I can help you troubleshoot more from there.
    Tom Dyas
    @tdyas
    make cleaner && make build fails due to no access to adapt-web repo:
    git clone git@gitlab.com:unboundedsystems/adapt-web.git web
    Cloning into 'web'...
    Warning: Permanently added the ECDSA host key for IP address '172.65.251.78' to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    /src/config/build_support/web.mk:30: recipe for target 'web/.git' failed
    make: *** [web/.git] Error 128
    make: *** [/home/tdyas/Projects/Adapt/adapt/config/build_support/dockerize.mk:36: .DOCKER_MAKE_DONE] Error 2
    Mark Terrel
    @mterrel
    Ok, I'll file a bug for that. I think it's not actually a permissions error in this case, despite the message. Try cloning it manually. So from the adapt repo directory: git clone git@gitlab.com:unboundedsystems/adapt-web.git web
    Oh, I may have spoken too soon. It may be a permissions problem. Investigating and fixing...
    Mark Terrel
    @mterrel
    Ok, adapt-web should be public now. Try make build again. It is somewhat possible that it still gives a permissions error in that context though. If you still see the permissions error, try the manual clone as suggested above. And either way, let me know how that goes and I'll file a bug if needed.
    Tom Dyas
    @tdyas
    I had to manually clone. Maybe the ssh key to authenticate with is not being passed into whatever Docker container things are running in?
    Mark Terrel
    @mterrel
    Yes, that's probably the case.
    Rahul Saxena
    @rksio_twitter
    Mark Terrel
    @mterrel
    Looks interesting. Sounds like a lot of custom work to pull all that together.
    Kirk Ross
    @kirkbross_gitlab

    kirkb@DESKTOP-5BF58I3 MINGW64 /e/Sites/wud/deploy

    $ adapt run k8s-test --deployID app-test
    [13:23:59] Installing node modules [started]
    [13:24:02] Installing node modules [failed]
    [13:24:02] → EBUSY: resource busy or locked, rmdir 'E:\Sites\wud\deploy'
    Error: EBUSY: resource busy or locked, rmdir 'E:\Sites\wud\deploy'
    Code: EBUSY

    Adapt version: 0.3.1
    Mark Terrel
    @mterrel
    Hi Kirk! Thanks for getting this info. Sorry again you're seeing this problem.
    Kirk Ross
    @kirkbross_gitlab
    Node version 12.18 .3