47ng / actions-clever-cloud

GitHub Action to deploy to Clever Cloud
https://clever-cloud.com
MIT License
38 stars 9 forks source link

Success Deploy infinite loop #205

Closed yanis-jedrzejczak-smart closed 10 months ago

yanis-jedrzejczak-smart commented 10 months ago

Hello,

I am facing an issue where my Node Express application, deployed on Clever Cloud through GitHub Actions, keeps restarting in a loop immediately after launch. Here are the details:

Setup: My application is set up with a staging.yml workflow file for CI/CD on GitHub Actions and a standard Dockerfile for a Node.js application.

Behavior: The CI/CD pipeline runs successfully, and the application deploys on Clever Cloud. However, as soon as it starts, it enters a continuous restart loop.

Here are my files :

.github/workflows/staging.yml

name: CI/CD
on:
  pull_request:
  release:
    types: [created, published, edited]
  push:
    branches:
      - staging

jobs:
  ci:
    name: Integration
    runs-on: ubuntu-latest    

    strategy:
      matrix:
        node-version: [16.x]
    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm ci
    - run: npm run build --if-present

  cd:
    name: Deployment
    needs: ci
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: 47ng/actions-clever-cloud@v1.3.1
        with:
          appID: app_38cc...
        env:
          CLEVER_TOKEN: ${{ secrets.CLEVER_TOKEN }}
          CLEVER_SECRET: ${{ secrets.CLEVER_SECRET }}

and my basic Dockerfile

FROM node:alpine

WORKDIR /usr/app

COPY ./package.json ./

RUN npm install

COPY ./ ./

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

And here are the logs : (I suspect this is linked to the docker run command that isn't running in detached mode or something like that...)

(I hided some sensitive informations in logs with "...")

Waiting for application logs…
2024-01-09T15:27:30.446Z: WARNING: Nokogiri was built against libxml version 2.10.4, but has dynamically loaded 2.11.4
2024-01-09T15:27:31.632Z: Preparing application environment…
2024-01-09T15:27:32.011Z: Configure and enable vector.service
2024-01-09T15:27:32.887Z: Inject CC_REVERSE_PROXY_IPS
2024-01-09T15:27:32.887Z: Inject INSTANCE_NUMBER
2024-01-09T15:27:32.887Z: Inject CC_DEPLOYMENT_ID
2024-01-09T15:27:32.888Z: Inject CC_APP_NAME
2024-01-09T15:27:32.888Z: Inject CC_USE_PULSAR_LOGSCOLLECTION
2024-01-09T15:27:32.888Z: Inject CC_OWNER_ID
2024-01-09T15:27:32.888Z: Inject CC_ENVIRON_UPDATE_URL
2024-01-09T15:27:32.888Z: Inject CC_ENVIRON_UPDATE_TOKEN
2024-01-09T15:27:32.888Z: Inject INSTANCE_TYPE
2024-01-09T15:27:32.888Z: Inject CC_PRETTY_INSTANCE_NAME
2024-01-09T15:27:32.888Z: Inject PORT
2024-01-09T15:27:32.888Z: Inject INSTANCE_ID
2024-01-09T15:27:32.888Z: Inject CC_INSTANCE_ID
2024-01-09T15:27:32.888Z: Inject COMMIT_ID
2024-01-09T15:27:32.888Z: Inject CC_COMMIT_ID
2024-01-09T15:27:32.888Z: Inject APP_ID
2024-01-09T15:27:32.888Z: Inject CC_APP_ID
2024-01-09T15:27:32.888Z: Inject APP_HOME
2024-01-09T15:27:32.888Z: Added sourceable file /home/bas/applicationrc
2024-01-09T15:27:32.895Z: Checking cache data: GET /api/builds/app_38cc..../docker-20230717
2024-01-09T15:27:32.919Z: A build cache archive exists, downloading in progress…
2024-01-09T15:27:35.392Z: Successfully downloaded build cache archive
2024-01-09T15:27:35.408Z: Generating public/private ed25519 key pair.
2024-01-09T15:27:35.408Z: Your identification has been saved in /home/bas/.ssh/id_ed25519
2024-01-09T15:27:35.408Z: Your public key has been saved in /home/bas/.ssh/id_ed25519.pub
2024-01-09T15:27:35.408Z: The key fingerprint is:
2024-01-09T15:27:35.408Z: SHA256:DR2S....
2024-01-09T15:27:35.408Z: The key's randomart image is:
2024-01-09T15:27:35.408Z: +--[ED25519 256]--+
...
2024-01-09T15:27:35.408Z: +----[SHA256]-----+
2024-01-09T15:27:35.936Z: Mounting persistent file system
2024-01-09T15:27:35.940Z: No Clever Cloud specific configuration file detected. Continuing…
2024-01-09T15:27:35.940Z: using python version 2
2024-01-09T15:27:36.119Z: Changing current directory to /home/bas/app_38cc… ...
2024-01-09T15:27:36.119Z: We are now in /home/bas/app_38cc..., let's build and run the app.
2024-01-09T15:27:36.119Z: Deploying commit ID f65c0...224
2024-01-09T15:27:36.322Z: CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
2024-01-09T15:27:36.323Z: Importing image from the cache…
2024-01-09T15:27:39.582Z: Successfully got application from cache
2024-01-09T15:27:39.648Z: Got image sha256:aac...84a, let's check if it exists
2024-01-09T15:27:39.666Z: clever       latest    sha256:aac...84a   49 minutes ago   148MB
2024-01-09T15:27:39.667Z: Executing docker run -p 8080:8080 -p 4040:4040 clever
2024-01-09T15:27:39.716Z: WARNING: Published ports are discarded when using host network mode
2024-01-09T15:27:40.971Z: > tp-clever-api@1.0.0 start
2024-01-09T15:27:40.971Z: > node app.js
2024-01-09T15:27:41.198Z: Example app listening on port 8080!
2024-01-09T15:27:44.667Z: Application start successful
2024-01-09T15:27:45.177Z: Successfully deployed in 0 minutes and 14 seconds
2024-01-09T15:27:45.177Z: No build cache archive was created. Not uploading anything.

Thanks for your help ❤️

yanis-jedrzejczak-smart commented 10 months ago

For some reasons, I can't re-create the scenario without any changes, seems fixed ...