Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Postfacto on Azure #315

Open
AX-DevOpsAdmin opened this issue Aug 25, 2020 · 10 comments
Open

Postfacto on Azure #315

AX-DevOpsAdmin opened this issue Aug 25, 2020 · 10 comments

Comments

@AX-DevOpsAdmin
Copy link

Afternoon, Kyle here from Leeming.
Having issues running Postfacto on Azure due to the app using port 3000 when the Azure app service can only use 443 and 80. Have attempted using WEBSITES_PORT 3000 and even PORT 3000 on the web app config to no avail.
Wondering if you could possibly produce a Docker postfacto/dev version with dependencies auto build which also is Azure friendly and uses ports available to the azure webapp (possibly EXPOSE 80 and EXPOSE 8080 within the dockerfile)

As you all know were new to this so just having a stab in the dark but think this is the reason behind the failures.

@textbook
Copy link
Contributor

Hi Kyle! postfacto/dev is the containerised development environment, to run the app in production you want postfacto/postfacto. Although the default port is 3000, it should honour the PORT environment variable if it's set on the container per ./api/config/puma.rb - EXPOSE is just metadata. Are you using Azure Web Apps for Containers?

@AX-DevOpsAdmin
Copy link
Author

Hi Kyle! postfacto/dev is the containerised development environment, to run the app in production you want postfacto/postfacto. Although the default port is 3000, it should honour the PORT environment variable if it's set on the container per ./api/config/puma.rb - EXPOSE is just metadata. Are you using Azure Web Apps for Containers?

Sorry, we was going from your contributing guide which states "to avoid having to install and manage these dependencies you can use the postfacto docker image for development". from that we thought that by using this within azure we wouldnt need to consider the dependencies as they will be ran from within the docker container.

yes we are using web apps for containers. but when trying to run we get the error code;
2020-08-25T09:37:18.502Z ERROR - Container scousetestwa_0_af27e38b didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2020-08-25T09:37:18.512Z INFO - Stopping site scousetestwa because it failed during startup.

After some research it seemed that we was required to change the EXPOSE variables within the docker image. We did try amend the WEBSITES_PORT config to 3000 but the same error occurred just with port 3000.

any help would be grateful haha

@textbook
Copy link
Contributor

postfacto/dev, built from ./docker/dev/Dockerfile, is for use in local or CI development. The app doesn't start when you run the container (you can start it in the container, but in a dev mode). For production run postfacto/postfacto, which is built from ./Dockerfile - that should accept the standard PORT environment variable to override the default port.

@AX-DevOpsAdmin
Copy link
Author

postfacto/dev, built from ./docker/dev/Dockerfile, is for use in local or CI development. The app doesn't start when you run the container (you can start it in the container, but in a dev mode). For production run postfacto/postfacto, which is built from ./Dockerfile - that should accept the standard PORT environment variable to override the default port.

Thank you for your help Jonathan, however once again were banging our heads against the wall;

2020-08-25T14:10:06.316Z INFO - Initiating warmup request to container scousetestwa_0_cf618460 for site scousetestwa
2020-08-25T14:10:21.759Z INFO - Waiting for response to warmup request for container scousetestwa_0_cf618460. Elapsed time = 15.4427628 sec
2020-08-25T14:10:37.966Z INFO - Waiting for response to warmup request for container scousetestwa_0_cf618460. Elapsed time = 31.6496824 sec
2020-08-25T14:10:53.495Z INFO - Waiting for response to warmup request for container scousetestwa_0_cf618460. Elapsed time = 47.179067 sec
2020-08-25T14:11:07.033Z ERROR - Container scousetestwa_0_cf618460 for site scousetestwa has exited, failing site start
2020-08-25T14:11:07.045Z ERROR - Container scousetestwa_0_cf618460 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2020-08-25T14:11:07.059Z INFO - Stopping site scousetestwa because it failed during startup.

again tried website_ports 80, 8000 and 3000 and still same error codes

@textbook
Copy link
Contributor

Interesting. Do you not see any logs from the Postfacto container itself? How are you providing the services (database and Redis)? It might be worth looking at the Helm chart to see how it's configured for deployment on Kubernetes, e.g. you can see env vars getting set in https://github.com/pivotal/postfacto/blob/master/deployment/helm/templates/deployment.yaml.

@mimozell
Copy link

@textbook we're having an issue with the same. This is our Dockerfile:

FROM postfacto/postfacto:4.3.0

ENV PORT=80

EXPOSE 80

but the app keeps starting on port 3000: * Listening on tcp://0.0.0.0:3000. Any thoughts?

@textbook
Copy link
Contributor

@mimozell the port is hard-coded in the entrypoint script, you can't currently change that from the environment: https://github.com/pivotal/postfacto/blob/fc775053346b22e9fadbe9ab863baf94fc1cabad/docker/release/entrypoint#L55

@mimozell
Copy link

Aha, I see. Thank you! Is the answer to the initial question that the port cannot be modified then?

@joshuacc
Copy link

It is now possible to change the port that Azure Web Apps for Containers looks for: https://docs.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux#configure-port-number

@ldennington
Copy link

ldennington commented May 7, 2022

Hello! I am attempting this deployment using an Azure Web App that I've configured for port 3000 using the instructions linked above by @joshuacc. However, I am still seeing the errors called out above:

Container gitfundamentalspostfacto_0_d21ecbbc for site gitfundamentalspostfacto has exited, failing site start
Container gitfundamentalspostfacto_0_d21ecbbc didn't respond to HTTP pings on port: 3000, failing site start

I also see that @textbook mentioned the database/Redis setup being a potential issue here. I am unsure of how to configure these correctly with a Docker Azure Web App deployment and wanted to see whether there is any guidance available for this scenario.

Edit: I was able to access the container logs and see the following, which may support the above assertion that there are steps that still need to be taken to set up the db:

2022-05-09T00:03:53.715053672Z ActiveRecord::AdapterNotSpecified: The `production` database is not configured for the `production` environment.
2022-05-09T00:03:53.715072973Z 
2022-05-09T00:03:53.715078373Z   Available databases configurations are:
2022-05-09T00:03:53.715082473Z 
2022-05-09T00:03:53.715086873Z   development
2022-05-09T00:03:53.715090673Z test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants