App Engine internal server error, operation is already in progress. What do I need to fix? - google-app-engine

I've been struggling to fix and Google App Engine Flexible deployment with app.yaml specifications:
runtime: nodejs
env: flex
The log tail shows that the application is listening, but it appears something is failing between the application and the proxy. I looks like it might be trying to start twice, though that may just be the npm command redirection:
022-09-20 21:07:05 default[v4]
2022-09-20 21:07:05 default[v4] > xxx#1.0.0 start
2022-09-20 21:07:05 default[v4] > nuxt start
2022-09-20 21:07:05 default[v4]
2022-09-20 21:07:20 default[v4] ℹ Listening on: http://localhost:8080/
2022-09-20 21:10:34 default[v4]
2022-09-20 21:10:34 default[v4] > artmuseoio#1.0.0 start
2022-09-20 21:10:34 default[v4] > nuxt start
2022-09-20 21:10:34 default[v4]
2022-09-20 21:10:50 default[v4] ℹ Listening on: http://localhost:8080/
2022-09-20 21:20:04 default[v4]
2022-09-20 21:20:04 default[v4] > artmuseoio#1.0.0 start
2022-09-20 21:20:04 default[v4] > nuxt start
2022-09-20 21:20:04 default[v4]
2022-09-20 21:20:18 default[v4] ℹ Listening on: http://localhost:8080/
The server logs complain of an error:
Cannot operate on apps/xxx/services/default because an operation is already in progress.
At the appspot url, the result is either a 502 Error, 503 Error, or -27 server error.
The application source is in .zip archive stored in a bucket in the same project.
I have tried:
Switching to standard deployment
Changing resources.
Changing readiness checks.
What can I investigate next?

Related

how to configure ecosystem.config.js file for next.js on apache

am trying to deploy nextjs app on apache using pm2.
I have installed latest versions of node, pm2. and apache is configured as reverse proxy.
but when am trying to start daemon process, it is not doing it. I cloned a project from github and ran 'npm run build, which created .next file and in that file, I created ecosystem.config.js file for pm2, it looks like this :
module.exports = {
apps : [{
name: "nextjs-app",
script: "npm",
args: "run build",
env: {
NODE_ENV: "production"
}
}]
};
but when I ran pm2 start npm -- start , terminal is giving me respone like this:
pm2 start npm -- start
[PM2] Spawning PM2 daemon with pm2_home=/home/georgianar/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /usr/local/bin/npm in fork_mode (1 instance)
[PM2] Done.
but when I try to see list of process, there is none, and when user tries to enter the website, site log shows that there is no service on port 3000
(111)Connection refused: AH00957: http: attempt to connect to 127.0.0.1:3000 (localhost:3000) failed
and
AH01114: HTTP: failed to make connection to backend: localhost
I dont know why, any idea why it is doing so?

How to deploy react app in Elastic beanstalk in a docker platform using Travis CI?

Environment health has transitioned from Ok to Severe. ELB processes are not healthy on all instances. ELB health is failing or not available for all instances.
I am deploying a react app in AWS using the docker platform. I am getting HEALTH-Severe issues when I deploy my app. I have also added custom TCP inbound rules in the EC2 instance (source-anywhere).
I am using free tier in AWS. The following is my Dockerfile.
FROM node:alpine as builder
WORKDIR '/app'
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx
EXPOSE 80
COPY --from=builder /app/build /usr/share/nginx/html
My .travis.yml file:
language: generic
sudo: required
services:
- docker
before_install:
- docker build -t username/docker-react -f Dockerfile.dev .
script:
- docker run -e CI=true username/docker-react npm run test
deploy:
provider: elasticbeanstalk
region: us-east-2
app: "docker-react"
env: "DockerReact-env"
bucket_name: "my bucket-name"
bucket_path: "docker-react"
on:
branch: master
access_key_id: $AWS_ACCESS_KEY
secret_access_key: $AWS_SECRET_KEY
When I open my app I am getting 502 Bad Gateway error.
I had the same problem. After reading some of the documentation here I figured maybe docker-compose.yml is actually picked up first before anything. Deleting my docker-compose.yml (which I was only using locally) solved the issue for me.

Docker: React container fails build

I was using a mac laptop to run my project and it worked but I started using a new one and now my project doesn't compile.
I'm currently using Docker Desktop v3.0.4 on macOS Big Sur v11.1
If I run my react project without Docker it compiles and runs. So i'm assuming its a docker issue but can't figure out what it is. Maybe a version issue.
docker-compose.yml:
version: "3.2"
services:
frontend:
build: ./frontend
volumes:
- ./frontend:/app
#One-way volume to use node_modules from inside image
- /app/node_modules
ports:
- "3000:3000"
#tty: true
command: npm start
Dockerfile:
# Use an official node runtime as a parent image
FROM node:8
ENV NPM_CONFIG_LOGLEVEL warn
#allows app_env to be set during build (defaults to empty string)
ARG app_env
#sets an environment variable to app_env argument, this way the variable will persist in the container for use in code
ENV APP_ENV $app_env
#all subsequent commands will now be run from inside this folder
WORKDIR /app/
#copy dependencies file
COPY package.json /app/
# Install dependencies
RUN npm install
# Add rest of the client code
COPY . /app/
EXPOSE 3000
CMD npm start
When I run docker-compose --verbose up --build the output is
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.41/containers/35ad92f5ac5ac433cedc991461be3b2d58dec97176db32e656010a4529f1eb49/start HTTP/1.1" 204 0
compose.cli.verbose_proxy.proxy_callable: docker start -> None
Creating websites_frontend_1 ... done
compose.parallel.feed_queue: Pending: set()
compose.parallel.parallel_execute_iter: Finished processing: <Service: frontend>
compose.parallel.feed_queue: Pending: set()
Attaching to websites_frontend_1
compose.cli.verbose_proxy.proxy_callable: docker events <- (filters={'label': ['com.docker.compose.project=websites', 'com.docker.compose.oneoff=False']}, decode=True)
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.41/events?filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dwebsites%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker events -> <docker.types.daemon.CancellableStream object at 0x10a619f90>
frontend_1 |
frontend_1 | > internal-beta-frontend#0.1.0 start /app
frontend_1 | > react-scripts start
frontend_1 |
frontend_1 | ℹ 「wds」: Project is running at http://172.18.0.2/
frontend_1 | ℹ 「wds」: webpack output is served from
frontend_1 | ℹ 「wds」: Content not from webpack is served from /app/public
frontend_1 | ℹ 「wds」: 404s will fallback to /
frontend_1 | Starting the development server...
frontend_1 |
compose.cli.verbose_proxy.proxy_callable: docker wait <- ('35ad92f5ac5ac433cedc991461be3b2d58dec97176db32e656010a4529f1eb49')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('35ad92f5ac5ac433cedc991461be3b2d58dec97176db32e656010a4529f1eb49')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.41/containers/35ad92f5ac5ac433cedc991461be3b2d58dec97176db32e656010a4529f1eb49/json HTTP/1.1" 200 None
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.41/containers/35ad92f5ac5ac433cedc991461be3b2d58dec97176db32e656010a4529f1eb49/wait HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker wait -> {'Error': None, 'StatusCode': 0}
websites_frontend_1 exited with code 0
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
'Args': ['npm', 'start'],
'Config': {'AttachStderr': False,
'AttachStdin': False,
'AttachStdout': False,
'Cmd': ['npm', 'start'],
'Domainname': '',
'Entrypoint': ['docker-entrypoint.sh'],
'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
'NODE_VERSION=8.17.0',
...
Why isn't my project building? What do I have to do to get it running?
I've had the same problem and what solved it was to exclude the project from Spotlight indexing tool. It seems that this one uses a lot of resources and that made the build fail. Go to System preferences and then search for Spotlight. Then go to Privacy tab and add the directories that have your projects. That might help.

POPULAR REACT ISSUE : How to run docker container serving a reactjs app in Azure using docker-compose?

I have been following this guide: https://www.docker.com/blog/how-to-deploy-containers-to-azure-aci-using-docker-cli-and-compose/ to deploy containers in Azure. When I run "docker compose up", I see the containers running in Azure but the reactjs container doesn't start properly. The logs show it fails with :
[34mℹ[39m [90m「wds」[39m: webpack output is served from
[34mℹ[39m [90m「wds」[39m: Content not from webpack is served from /app/public
[34mℹ[39m [90m「wds」[39m: 404s will fallback to /
Starting the development server...
Following is my docker-compose file :
version: "3.8"
services:
frontend:
image: suyashpatel98/tic-tac-toe-frontend
stdin_open: true
tty: true
environment:
- CI=true
depends_on:
- backend
expose:
- "3000"
ports:
- "3000:3000"
backend:
image: suyashpatel98/tic-tac-toe-backend
ports:
- "8080:8080"
Locally both frontend and backend containers run just fine after "docker-compose up" command is executed but I run into the aforementioned error when I try to run the containers on Azure. Please find the source-code for reference here: https://github.com/suyashpatel98/tic-tac-toe-app
Downgrading react-scripts to 3.4.0 works for me

Bad Gateway 502 - Google App Engine - [CRITICAL] WORKER TIMEOUT

I was working on deploying my web application via Google App Engine when I encountered a 502 Bad Gateway Error(Nginx). After running gcloud app logs read, I tracked the error down to be:
2020-05-12 00:15:59 default[20200511t163633] "GET /input/summary" 200
2020-05-12 00:16:38 default[20200511t163633] [2020-05-12 00:16:38 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:9)
2020-05-12 00:16:38 default[20200511t163633] [2020-05-12 00:16:38 +0000] [9] [INFO] Worker exiting (pid: 9)
2020-05-12 00:16:38 default[20200511t163633] [2020-05-12 00:16:38 +0000] [15] [INFO] Booting worker with pid: 15
2020-05-12 00:16:38 default[20200511t163633] "POST /input/summary" 502
For those wondering, my app.yaml looks like this:
runtime: custom
env: flex
runtime_config:
python_version: 3
resources:
cpu: 4
memory_gb: 16
disk_size_gb: 25
readiness_check:
app_start_timeout_sec: 900
My Dockerfile looks like this:
FROM gcr.io/google-appengine/python
RUN virtualenv /env -p python3.7
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
ADD requirements.txt /app/requirements.txt
RUN pip3 install -r /app/requirements.txt
ADD . /app
RUN apt-get update \
&& apt-get install tesseract-ocr -y
EXPOSE 8080
ENTRYPOINT ["gunicorn", "--bind=0.0.0.0:8080", "main:app"]
I am running the app through:
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8080)
Everything seems to work fine on localhost but the problems arise when I deploy to Google App Engine. Does anyone know what may be the root of the issue? Thanks in Advance!
Is it failing to deploy? Or does the deploy succeed, but the server fails to run?
If its failing to deploy, you may be hitting the 10 minute timeout that deploy jobs have to finish. You can increase this number by setting your local gcloud config.
gcloud config set app/cloud_build_timeout 1200s

Resources