https://garden.io logo
#🌱|help-and-getting-started
Setting up PHP-FPM
# 🌱|help-and-getting-started
s

swift-spring-8620

08/28/2023, 5:01 AM
Hey, After spending some time messing around with garden.io I have not been able to get php-fpm to work. I tried configuring both an external ingress and trying to configure the default ingress, but I have been unsuccessful in all my attempts to get my laravel application to serve. My current garden.yml for php-fpm is as follows: kind: Build type: container name: php-fpm --- kind: Deploy description: The php container name: php-fpm type: container build: php-fpm spec: ports: - name: https protocol: TCP containerPort: 9000 sync: paths: - target: /var/www/html source: ../../src ingresses: - annotations: nginx.ingress.kubernetes.io/rewrite-target: /index.php?$2 nginx.ingress.kubernetes.io/add-base-url: "true" nginx.ingress.kubernetes.io/backend-protocol: "FASTCGI" nginx.ingress.kubernetes.io/fastcgi-index: "index.php" nginx.ingress.kubernetes.io/fastcgi-params-configmap: "php-fpm-fastcgi-configmap" # Add other annotations as required path: / hostname: dev-vytal.ap.ngrok.io port: https Any help pointing me in the right direction for how to properly get this setup for PHP-FPM would be greatly appreciated. I am relatively new to kubernetes and garden.io in general, so my apologies in advance if I am overlooking something crucial. Thanks in advance, Price
q

quaint-dress-831

08/28/2023, 11:38 AM
Hi @swift-spring-8620, can you share logs or what specifically isn't working for you? Generally you'll want to start at an MVP that gets an action working then layer on features. Because I don't know what in particular is unsuccessful for you, I can offer some first suggestions: - can you move any dependent ConfigMap values to the Deploy itself? - I'd drop Code Synchronization for now - start at the most atomic unit of functional
Based on your questions in #1120389258683883692, the error
Copy code
console
Emitted 'error' event on WebSocketServer instance at:
    at Server.emit (node:events:549:35)
    at Server.incomingRequest (/snapshot/project/tmp/pkg/cli/node_modules/@opentelemetry/instrumentation-http/build/src/http.js:280:33)
    at emitErrorNT (node:net:1449:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'EADDRINUSE',
  errno: -48,
  syscall: 'listen',
  address: '::1',
  port: 9777
means this port is in use and that sounds to me like you're running more than one instance of
garden
locally.
Can you check your process manager and ensure there's only one
garden
process?
s

swift-spring-8620

08/29/2023, 5:20 AM
@quaint-dress-831 Thanks for getting back to me so quickly. I was able to resolve the error that was given above, and I can confirm that from that end everything seems to be working correctly. I was able to get a fast api application up and running with no issues as a test. In regards to PHP-FPM, I tried as you suggested and have been able to now get requests reaching my php service. My original issue was a result of an incorrect annotation that was being used in my configuration. However, I am now getting a 404 error, with the page displaying "File not found". I believe the 404 has something to do with either the root directive in the nginx configuration or the lack of a shared volume (which I have completely forgot to setup). I am currently in the process of setting up a shared volume now and will update if that resolves the problem, but in the meantime I was curious if there was a way to adjust the root directive for nginx using garden? I'm still trying to fully wrap my head around how nginx is setup and working in garden, so any insight is much appreciated. My apologies, if these questions are silly I'm still new to kubernetes and using garden in general, so some of the concepts are still very raw to me, so its likely I'm overlooking something. As always, your help is much appreciated!
q

quaint-dress-831

08/30/2023, 9:12 AM
@swift-spring-8620 hmm this is unfamiliar territory for me but if I search around, I find https://kubernetes.github.io/ingress-nginx/user-guide/fcgi-services/, which gives an example ConfigMap, Service, Pod and Ingress object. You could start by deploying their example. Make sure to delete your NGINX Ingress controller on your cluster first with
kubectl delete ns garden-system
then deploy with
garden deploy --force-refresh
after you've deployed the ConfigMap to pick up the controller deletion
s

swift-spring-8620

08/30/2023, 8:18 PM
@quaint-dress-831 Hey, thanks for the suggestion. I was actually able to get everything setup using the default ingress and setting up an additional nginx server to handle the serving of the static files. Everything seems to be in order now, and I appreciate the timeliness of your replies! Thanks again
3 Views