Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Stack #13307

Closed
5 tasks done
svor opened this issue May 10, 2019 · 6 comments
Closed
5 tasks done

PHP Stack #13307

svor opened this issue May 10, 2019 · 6 comments
Assignees
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed. status/in-progress This issue has been taken by an engineer and is under active development.

Comments

@svor
Copy link
Contributor

svor commented May 10, 2019

Make a PHP stack with examples as described in #12620

@svor svor added status/in-progress This issue has been taken by an engineer and is under active development. kind/task Internal things, technical debt, and to-do tasks to be performed. team/languages labels May 10, 2019
@svor svor self-assigned this May 10, 2019
@svor
Copy link
Contributor Author

svor commented May 10, 2019

As an image I've tried to use php:7-apache which contains Apache Web server which is needed for samples (Hello World).
I faced next problems:

  1. Apache Server can not be started: Permission denied: make_sock: could not bind to address [::]:80. To solve this problem I need to edit the configuration in /etc/apache2 folder, but I can't do that in minishift (have no permissions)
  2. Some of samples for example sample2 require to install some packages, at least I need to install composer which is Dependency Manager for PHP and I also can not do that because of permissions.

I think all these problems we can solve by creating new image to extend official and make all needed changes in our Dockerfile.
@l0rd @tsmaeder Should I start to do that or we must use only official image?

@l0rd
Copy link
Contributor

l0rd commented May 10, 2019

@svor your problem is the same problem we have faced for other stacks: the official images that we found on docker hub are not suited for development on an unprivileged kubernetes pod (i.e. the default on openshift).

I would like to avoid to create and maintain a new PHP image and my recommendation would be to look at the official s2i image https://github.com/sclorg/s2i-php-container that are designed to be run on unprivileged pods. That image should be just fine to run the PHP LS.

Anyway it's not clear from your description but what we agreed with @tolusha is that you should use 2 separate containers: one for the LS and one for runtime container (aka the recipe). The image can be the same (i.e. the official s2i image) or, if your runtime container needs some prerequisites that are not in the LS image, you can create a custom image that use the LS image as it's base image (i.e. FROM <php-s2i-image>

@svor
Copy link
Contributor Author

svor commented May 16, 2019

After my investigation I think we can't just reuse existing official image: https://hub.docker.com/r/centos/php-70-centos7 or https://hub.docker.com/_/php because of:

  • https://hub.docker.com/r/centos/php-70-centos7 - it requires to use source-to-image (S2I) toolkit to build and provide ready to run docker image, so, I don't think we can use this image for our runtime container
  • https://hub.docker.com/_/php - this image doesn't contain some utilities to build php applications (for example php composer) and also Apache configuration should be overridden to make it possible to preview samples and we can do that by extending this image.
    That's why I decided to create custom image that use https://hub.docker.com/_/php as it's base image - here we have an ability to reconfigure Apache server and install what we need

@l0rd
Copy link
Contributor

l0rd commented May 17, 2019

@svor I don't see any other alternative so let's proceed this way

@svor
Copy link
Contributor Author

svor commented May 20, 2019

@l0rd All samples except HelloWorld require database. As I understand the database should be run in a different container. So, the recipe should be like

"recipe": {
            "contentType": "text/x-yaml",
            "type": "kubernetes",
            "content": ""
}

Am I right?

@l0rd
Copy link
Contributor

l0rd commented May 23, 2019

@svor correct. But I would use 2 different stacks: PHP and PHP MySQL (or whatever db you are going to use). For reference I was using the following recipe for Java Postgres stack:

        "recipe": {
          "content": "apiVersion: v1\nkind: List\nitems:\n- apiVersion: apps/v1\n  kind: Deployment\n  metadata:\n    labels:\n      name: java-postgres-stack\n    name: java-postgres-stack\n  spec:\n    replicas: 1\n    selector:\n      matchLabels:\n        name: java-postgres-stack\n    template:\n      metadata:\n        labels:\n          name: java-postgres-stack\n        name: java-postgres-stack\n      spec:\n        containers:\n        - image: postgres\n          name: postgres\n          ports:\n          - name: postgres\n            containerPort: 5432\n            hostPort: 5432\n        - image: maven\n          command: ['sleep']\n          args: ['infinity']\n          name: maven\n          ports:\n          - containerPort: 8080\n            name: http-server\n",
          "type": "kubernetes",
          "contentType": "application/x-yaml"
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed. status/in-progress This issue has been taken by an engineer and is under active development.
Projects
None yet
Development

No branches or pull requests

2 participants