apprunner-roadmap icon indicating copy to clipboard operation
apprunner-roadmap copied to clipboard

is this project alive?

Open akhoury opened this issue 1 year ago • 10 comments

akhoury avatar Sep 24 '23 08:09 akhoury

I'll borrow this thread to share my similar concern/question today.

I'm an independent developer playing with a toy project. Apprunner seems to be what I need, at least based on the documentation and marketing materials. However, I spent a few more hours trying to set it up but hardly moved forward.

  1. It tells me service creation and update failed but these are the only log I saw. What went wrong?
09-24-2023 02:08:09 PM [AppRunner] Starting source code build.
09-24-2023 02:08:09 PM [AppRunner] Successfully Validate configuration file.
09-24-2023 02:08:08 PM [AppRunner] Reading apprunner.yaml config file.
09-24-2023 02:07:41 PM [AppRunner] Successfully pulled source code.
09-24-2023 02:07:36 PM [AppRunner] Successfully created pipeline for automatic deployments.
09-24-2023 02:06:55 PM [AppRunner] Service status is set to OPERATION_IN_PROGRESS.
  1. I don't see the Go to Environment variables - optional under Service settings in the AWS Console. As described in the document. https://docs.aws.amazon.com/apprunner/latest/dg/env-variable-manage.html

  2. There is a red banner at top saying web ACL is missing. But my understanding is that it's optional. Is it required?

kachebb avatar Sep 24 '23 21:09 kachebb

I couldn't get a simple nodejs project https://github.com/drschoice/aws-apprunner-demo0 running with the proper ENV VARs during build...

  1. if I use apprunner.yaml
version: 1.0
runtime: nodejs16
build:
  env:
    - name: MYVAR
      value: FOO
  commands:
    pre-build:
      - echo "------------------------------------------------pre-build_start--------------------------------------------"
      - env
      - echo "------------------------------------------------pre-build_end--------------------------------------------
    build:
      - echo "------------------------------------------------build_start--------------------------------------------"
      - env
      - npm install
      - npm run build
      - echo "------------------------------------------------build_end--------------------------------------------"
    post-build:
      - echo "------------------------------------------------post-build_start--------------------------------------------"
      - env
      - echo "------------------------------------------------post-build_end--------------------------------------------
run:
  command: npm start
  network:
    port: 3000
  env:
    - name: MYVAR
    - value: FOO

The build process gets called TWICE, once with the proper ENV VARs and the second time without them lol (the env command step under the build will verify this), which clobbers the first one or loses it, there goes your proper build, I think what's happening, from the logs at least is that app runner is not plumbing the ENV VARs correctly to all the intermediate containers during the build time

  1. and if i don't use a config yaml file, just use the UI, you can't use pre-build, post-build and the ENV VARs that you set in the UI don't get passed any of the *build steps Screenshot 2023-09-25 at 7 06 03 PM Screenshot 2023-09-25 at 7 06 09 PM

Screenshot 2023-09-25 at 8 05 05 PM

This is my build script by the way: Screenshot 2023-09-25 at 8 06 16 PM

akhoury avatar Sep 25 '23 17:09 akhoury

It seems we have a couple of separate issues here which I'm glad to help you work through. First things first - for the first post, can you provide the service arn for us to take a look? For the second comment, multiple start commands are not supported but build commands should be. I'd also like the service arn so we can take a closer look.

jsheld avatar Sep 25 '23 19:09 jsheld

multiple start commands

I am not using multiple start commands

I'd also like the service arn

i deleted it, now when I try to re-create it fails

Screenshot 2023-09-26 at 9 55 05 AM

Screenshot 2023-09-26 at 9 57 02 AM

arn arn:aws:apprunner:us-east-1:979199114165:service/aws-demo0/228c56f89db445dcbe7d56d39012e2a6

EDIT: finally got it to deploy, don't ask me how.

akhoury avatar Sep 26 '23 06:09 akhoury

@jsheld notice how the build command was called twice, the first time with the proper BUILD ENV VARs, the 2nd time without them, look for MYVAR in the logs txt file attached, or highlighted in the screenshot as well.

Screenshot 2023-09-26 at 1 10 38 PM

deployment_ca0e8bfdb49243ea9106f77c9fd9581c.txt

YAML

version: 1.0
runtime: nodejs16
build:
  commands:
    build:
      - echo "------------------------------------------------build_start--------------------------------------------"
      - npm install
      - npm run build 
      - echo "------------------------------------------------build_done--------------------------------------------"
  env:
    - name: MYVAR
      value: FOO
run:
  command: npm run start
  network:
    port: 3000
    env: PORT
  env:
    - name: MYVAR
      value: FOO

akhoury avatar Sep 26 '23 10:09 akhoury

@jsheld

Ok so, what's happening is

  1. pre-build <-- with ENV VARs
  2. build <-- with ENV VARs
  3. post-build <-- with ENV VARs
  4. build <-- again! why?? and this time without the ENV VARs

See the logs below for apprunner.yaml

https://github.com/drschoice/aws-apprunner-demo0/blob/6d501a843f3280a80ee27b2a3c1529e4b2021b49/apprunner.yaml

deployment_2b6be6b65c9148b59e94adaca324fef2.json.txt

I will leave this sample app running for 1 week, then I will delete it, arn:aws:apprunner:us-east-1:979199114165:service/aws-demo0/228c56f89db445dcbe7d56d39012e2a6 unless I can just pause and can you still investigate

akhoury avatar Sep 26 '23 10:09 akhoury

This is still an issue I am running into with my project. I am currently getting around it by setting my NodeJS ENV variables before the build command that needs them. Is this being worked on at all?

build:
  commands:
    pre-build:
      - npm install
    build:
      - MY_ENV_VAR='foo' npm run build
  # env:
  # This doesn't seem to work correctly?
  # https://github.com/aws/apprunner-roadmap/issues/212
  #   - name: MY_ENV_VAR
  #     value: 'foo'

zjkipping avatar Feb 05 '24 23:02 zjkipping

@zjkipping this is very risky for sensitive secrets, I don't want to add them to my code repo

akhoury avatar Feb 06 '24 10:02 akhoury

@akhoury Yep, that is entirely fair and a fairly bad limitation of this service. Thankfully I don't have any secrets I need to pass into my build scripts currently. Just plain text environment variables that can be committed.

zjkipping avatar Feb 06 '24 13:02 zjkipping