DopplerHQ / cli

The official CLI for interacting with your Doppler secrets and configuration.
https://docs.doppler.com
Apache License 2.0
214 stars 43 forks source link

how could I use doppler in fly.io? nodejs #348

Closed Charlie50503 closed 1 year ago

Charlie50503 commented 1 year ago

I'm tring to use doppler to delpy with fiy.io but deploy always got failed.

my dockerfile

FROM debian:bullseye as builder

ARG NODE_VERSION=16.17.0

RUN apt-get update; apt install -y curl
RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH /root/.volta/bin:$PATH
RUN volta install node@${NODE_VERSION}

#######################################################################
# Install Doppler CLI
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \
    curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | apt-key add - && \
    echo "deb https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \
    apt-get update && \
    apt-get -y install doppler

##############

RUN mkdir /app
WORKDIR /app

ENV NODE_ENV production

COPY . .

RUN npm install
FROM debian:bullseye

LABEL fly_launch_runtime="nodejs"

COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app

WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH

CMD ["doppler", "run", "--", "npm", "start"]

log

2022-11-12T10:45:01.631 runner[6e9e9d5e] hkg [info] Starting instance

2022-11-12T10:45:03.293 runner[6e9e9d5e] hkg [info] Configuring virtual machine

2022-11-12T10:45:03.294 runner[6e9e9d5e] hkg [info] Pulling container image

2022-11-12T10:45:04.111 runner[6e9e9d5e] hkg [info] Unpacking image

2022-11-12T10:45:04.123 runner[6e9e9d5e] hkg [info] Preparing kernel init

2022-11-12T10:45:04.565 runner[6e9e9d5e] hkg [info] Configuring firecracker

2022-11-12T10:45:05.019 runner[6e9e9d5e] hkg [info] Starting virtual machine

2022-11-12T10:45:05.322 app[6e9e9d5e] hkg [info] Starting init (commit: 81d5330)...

2022-11-12T10:45:05.351 app[6e9e9d5e] hkg [info] Preparing to run: `doppler run -- npm start` as root

2022-11-12T10:45:05.366 app[6e9e9d5e] hkg [info] Error: UnhandledIoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })

2022-11-12T10:45:05.368 app[6e9e9d5e] hkg [info] [ 0.131782] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100

2022-11-12T10:45:05.369 app[6e9e9d5e] hkg [info] [ 0.133609] CPU: 0 PID: 1 Comm: init Not tainted 5.12.2 #1

2022-11-12T10:45:05.369 app[6e9e9d5e] hkg [info] [ 0.134903] Call Trace:

2022-11-12T10:45:05.370 app[6e9e9d5e] hkg [info] [ 0.135485] show_stack+0x52/0x58

2022-11-12T10:45:05.371 app[6e9e9d5e] hkg [info] [ 0.136356] dump_stack+0x6b/0x86

2022-11-12T10:45:05.372 app[6e9e9d5e] hkg [info] [ 0.137102] panic+0xfb/0x2bc

2022-11-12T10:45:05.373 app[6e9e9d5e] hkg [info] [ 0.137763] do_exit.cold+0x60/0xb0

2022-11-12T10:45:05.374 app[6e9e9d5e] hkg [info] [ 0.138627] do_group_exit+0x3b/0xb0

2022-11-12T10:45:05.374 app[6e9e9d5e] hkg [info] [ 0.139553] __x64_sys_exit_group+0x18/0x20

2022-11-12T10:45:05.375 app[6e9e9d5e] hkg [info] [ 0.140552] do_syscall_64+0x38/0x50

2022-11-12T10:45:05.375 app[6e9e9d5e] hkg [info] [ 0.140552] entry_SYSCALL_64_after_hwframe+0x44/0xae

2022-11-12T10:45:05.375 app[6e9e9d5e] hkg [info] [ 0.141022] RIP: 0033:0x7fdda03da8b9

2022-11-12T10:45:05.377 app[6e9e9d5e] hkg [info] [ 0.141440] Code: eb ef 48 8b 76 28 e9 a5 03 00 00 64 48 8b 04 25 00 00 00 00 48 8b b0 b0 00 00 00 e9 af ff ff ff 48 63 ff b8 e7 00 00 00 0f 05 <ba> 3c 00 00 00 48 89 d0 0f 05 eb f9 66 2e 0f 1f 84 00 00 00 00 00

2022-11-12T10:45:05.378 app[6e9e9d5e] hkg [info] [ 0.143302] RSP: 002b:00007fffd3585378 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7

2022-11-12T10:45:05.379 app[6e9e9d5e] hkg [info] [ 0.144102] RAX: ffffffffffffffda RBX: 00007fdda016a8e0 RCX: 00007fdda03da8b9

2022-11-12T10:45:05.381 app[6e9e9d5e] hkg [info] [ 0.145240] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001

2022-11-12T10:45:05.382 app[6e9e9d5e] hkg [info] [ 0.146753] RBP: 0000000000000001 R08: 00007fdda04b1ba0 R09: 0000000000000000

2022-11-12T10:45:05.382 app[6e9e9d5e] hkg [info] [ 0.147587] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffd35853d8

2022-11-12T10:45:05.384 app[6e9e9d5e] hkg [info] [ 0.149293] Kernel Offset: disabled : 0000000000000000 R15: 0000000000000000

2022-11-12T10:45:05.384 app[6e9e9d5e] hkg [info] [ 0.149293] Kernel Offset: disabled

2022-11-12T10:45:05.385 app[6e9e9d5e] hkg [info] [ 0.149737] Rebooting in 1 seconds..

does anyone know the cause of the problem ?

Siddhant-K-code commented 1 year ago

I personally recommend you to install using this official shell script or check their docker guide:

(curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh || wget -t 3 -qO- https://cli.doppler.com/install.sh) | sh

In your Dockerfile, it looks, like you haven't configured doppler, i.e. I cannot see doppler setup (which would req. a $DOPPLER_TOKEN in your docker environment). Then you can execute all your commands. Hope it helps 😃

Piccirello commented 1 year ago

Doppler now has a native integration for syncing your secrets with fly.io. Docs: https://docs.doppler.com/docs/flyio