1

I am inexperienced with Dev Ops, which drew me to using Google App Engine to deploy my MERN application. Currently, I have the following Dockerfile and entrypoint.sh:

# Dockerfile
FROM node:13.12.0-alpine
WORKDIR /app
COPY . ./
RUN npm install --silent  
WORKDIR /app/client
RUN npm install --silent
WORKDIR /app
RUN chmod +x /app/entrypoint.sh
ENTRYPOINT [ "/app/entrypoint.sh" ]
# Entrypoint.sh
#!/bin/sh
node /app/index.js &
cd /app/client
npm start

The React front end is in a client folder, which is located in the base directory of the Node application. I am attempting to deploy these together, and would generally prefer to deploy together rather than separate. Running docker-compose up --build successfully redeploys my application on localhost.

I have created a very simple app.yaml file which is needed for Google App Engine:

# app.yaml
runtime: custom
env: standard

I read in the docs here to use runtime: custom when using a Dockerfile to configure the runtime environment. I initially selected a standard environment over a flexible environment, and so I've added env: standard as the other line in the app.yaml.

After installing and running gcloud app deploy, things kicked off, however for the last several hours this is what I've seen in my terminal window:

enter image description here

Hours seems like a higher magnitude of time than what seems right for deploying an application, and I've begun to think that I've done something wrong.

halfer
  • 19,824
  • 17
  • 99
  • 186
Canovice
  • 9,012
  • 22
  • 93
  • 211
  • 1
    "long story short" are you uploading libraries and modules in this? – mehta-rohan Apr 15 '20 at 17:04
  • probably, yes. I ran `gcloud app deploy` from the root directory of my node application, which contains the libraries for both node, as well as the client folder that has the libraries for react -- Is 28376 a lot of files? – Canovice Apr 15 '20 at 17:09
  • 1
    gcloud must have some ignore files kind of stuff, you should try it, one you able to send your code to gcloud, you should reinstall the dependencies on the cloud itself and start your server – mehta-rohan Apr 15 '20 at 17:26
  • Doesn't the app engine / gcloud need the libraries though? If I ignore them, how will the app engine use these libraries? – Canovice Apr 15 '20 at 17:29
  • 1
    Generally speaking no, you only have to upload your code or in this case your image. The fewer files the best App Engine works. – Juancki Apr 16 '20 at 09:14

1 Answers1

1

You are probably uploading more files than you need.

Use .gcloudignore file to describe the files/folders that you do not want to upload. LINK

You may need to change the file structure of your current project.

Additionally, it might be worth researching further the use of the Standard nodejs10 runtime. It uploads and starts much faster than the Flexible alternative (custom env is part of App Engine Flex). Then you can deploy each part to a different service.

Juancki
  • 1,793
  • 1
  • 14
  • 21