• Uncategorized

About linux : Unable-to-connect-Filestore-from-Cloudrun

Question Detail

I want to connect Filestore from CloudRun , I have defined it on my run.sh script that run the node app and mount
command to connect to the filestore , my node app is running on cloud run but not able to mount to the filestore , I have
attached a link to my nodejs codes , also in my script after the node command no other command runs.
I am following the official Google doc.

Problem on my run script:

node /app/index.js        //working on cloudrun

mkdir -p $MNT_DIR          //not working on cloudrun

chmod 775 $MNT_DIR          //not working on cloudrun

echo "Mounting Cloud Filestore."  //not working on cloudrun

mount --verbose -t nfs -o vers=3 -o nolock 10.67.157.122:/filestore_vol1/test/testing/ $MNT_DIR //not working

echo "Mounting completed." //not working on cloudrun

Note :- if I place node /app/index.js after echo “Mounting completed.” //node app doesn’t starts on cloudrun

I am attaching my code URL here.

My Docker file:

FROM node:slim

# Install system dependencies
RUN apt-get update -y && apt-get install -y \
    tini \
    nfs-common \
    procps   \
    && apt-get clean

# Set working directory
WORKDIR /app

# Set fallback mount directory
ENV MNT_DIR /app2

# Copy package.json to the working directory
COPY package*.json ./

# Copy all codes to the working directory
COPY . .

# Ensure the script is executable
RUN chmod +x /app/run.sh

# Use tini to manage zombie processes and signal forwarding
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]

ENV PORT=8080

EXPOSE 8080
EXPOSE 2049

# Pass the startup script as arguments to tini
CMD ["/app/run.sh"]


# My run.sh script file

#!/bin/bash
set -eo pipefail

node /app/index.js

# Create mount directory for service.
mkdir -p $MNT_DIR
chmod 775 $MNT_DIR

echo "Mounting Cloud Filestore."
mount --verbose -t nfs -o vers=3 -o nolock 10.x.x.122:/filestore_vol1/test/testing/ $MNT_DIR
echo "Mounting completed."

# Exit immediately when one of the background processes terminate.
wait -n

#main goal is to mount cloud run with filestore and start my node app

Question Answer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.