sobojack

sobojack

I have a Phoenix app that I am deploy to Kuberenetes. My deploy script was working fine then all of a sudden it started erroring out asking for python. I tried adding adp add python but that did not help. I am using bitwalker/alpine-elixir:latest and bitwalker/alpine-erlang-base:latest. My error is $ apk add --update make ca-certificates openssl python fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz ERROR: unsatisfiable constraints: python (missing): required by: world[python] ERROR: Job failed: exit code 1

My gitlab-ci.yaml file looks like this

stages:
  - assets
  - build
  - deploy

assets:
  image: node:11
  stage: assets
  script:
    - cd assets
    - npm install
    - npm run elm-package-install
    - npm run deploy
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - assets/node_modules/
      - assets/elm-stuff/
  artifacts:
    paths:
      - priv/static/

# Build the app
build:
  image: bitwalker/alpine-elixir:latest
  stage: build
  script:
    # Add required build dependencies
    - apk update 
    - apk upgrade 
    - apk add build-base
    # First thing, let's check code formatting
    - mix format --check-formatted
    # Install Dependencies
    - mix deps.get
    # Run tests
    # - mix test
    # Build Assets
    - MIX_ENV=prod mix compile
    - MIX_ENV=prod mix phx.digest
    # Build release
    - MIX_ENV=prod mix distillery.release --env=prod
    # Store Release
    - export RELEASE_DIR=`ls -d _build/prod/rel/order_management_portal/releases/*/`
    - mv $RELEASE_DIR/order_management_portal.tar.gz order_management_portal.tar.gz
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - deps
      - _build/test
      - _build/prod
  artifacts:
    paths:
      - order_management_portal.tar.gz
  
# DEPLOY THE APP WITH DOCKER
deploy:
  stage: deploy
  only:
    - dev
    - stage
    - master
  dependencies: 
    - build
  image: docker:latest
  variables:
    DOCKER_DRIVER: overlay2
    IMAGE_NAME: order-management
    GCP_PROJECT_ID: beswick-engineering
  services:
    - docker:dind

  script:
    # Create our image.
    # Unzip application tarball
    - mkdir export
    - tar -xf "order_management_portal.tar.gz" -C export
    # Build docker image
    - docker build -t $IMAGE_NAME:$CI_COMMIT_REF_SLUG .
     # Install CA certs, openssl to https downloads, python for gcloud sdk
    - apk add --update make ca-certificates openssl python
    - update-ca-certificates
    # Write our GCP service account private key into a file
    - echo $GCLOUD_SERVICE_KEY | base64 -d > ${HOME}/gcloud-service-key.json
    # Download and install Google Cloud SDK
    - wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
    - tar zxf google-cloud-sdk.tar.gz && ./google-cloud-sdk/install.sh --usage-reporting=false --path-update=true
    - google-cloud-sdk/bin/gcloud --quiet components update
    - google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
    # Push to registry
    # Tag our image for container registry
    - docker tag $IMAGE_NAME:$CI_COMMIT_REF_SLUG gcr.io/$GCP_PROJECT_ID/$IMAGE_NAME:$CI_COMMIT_REF_SLUG
    # Push to repository
    - google-cloud-sdk/bin/gcloud docker -- push gcr.io/$GCP_PROJECT_ID/$IMAGE_NAME:$CI_COMMIT_REF_SLUG
    # Deploy only for master branch
    - |
      
      if [ "$CI_COMMIT_REF_SLUG" = "dev" ]; then
        # Configure Kube control
        google-cloud-sdk/bin/gcloud components install kubectl
        google-cloud-sdk/bin/gcloud container clusters get-credentials beswick --zone us-central1-a --project $GCP_PROJECT_ID
        google-cloud-sdk/bin/kubectl patch deployment order-manager-dev -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"

      else if [ "$CI_COMMIT_REF_SLUG" = "master" ]; then
        # Configure Kube control
        google-cloud-sdk/bin/gcloud components install kubectl
        google-cloud-sdk/bin/gcloud container clusters get-credentials beswick --zone us-central1-a --project $GCP_PROJECT_ID
        google-cloud-sdk/bin/kubectl patch deployment order-manager-prod -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
      fi
      fi

and my dockerfile looks like this

#================
#Deployment Stage
#================
FROM bitwalker/alpine-erlang-base:latest

# RUN add erlang-cryto

#Set environment variables and expose port
EXPOSE 4000
ENV REPLACE_OS_VARS=true
ENV PORT=4000

COPY export/ .

CMD ["/opt/app/bin/order_management_portal", "foreground"]

Any help would be greatly appreciated!

Showing Posts 1 to 4

NobbZ

NobbZ

It’s python2 or python3 respectively AFAIR.

sobojack

sobojack OP

I tried adding - apk add python2 and - apk add python3 and both resulted in the same error.

NobbZ

NobbZ

In which same error? As you have changed the requested package name, at least that part should change…

sobojack

sobojack OP

changing this - apk add --update make ca-certificates openssl python

to this - apk add --update make ca-certificates openssl python2 was the fix

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

kuligkar
If you’re flying into Chicago for ElixirConf US, you’ll probably land on Tuesday with an evening to fill. We teamed up with dscout to run...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews