paketo-community / staticfile Goto Github PK
View Code? Open in Web Editor NEWA Cloud Native Buildpack to provide default server configurations
A Cloud Native Buildpack to provide default server configurations
When i use paketo-buildpacks/nginx version 0.5.3 and paketo-community/staticfile version 0.2.0 to build an image everything works as expected and container starts without issues. But when i build an image with newer paketo-buildpacks/nginx:0.6.0 & paketo-community/staticfile:0.2.0 the resulting container exists with the following error:
[emerg] 1#0: open() "/workspace/logs/nginx/error.log" failed (2: No such file or directory)
Create Draft Release workflow failed.
Please upgrade to the latest packit v2 release to enable new features and extended support.
The README in this repo implies that I can specify the root directory that NGINX will use to serve assets from. The following buildpack.yml structure currently errors out.
staticfile:
nginx:
root: "dist/hello-world"
Looks like it's just hardcoded to serve assets from "public" directory
pack build -b https://github.com/paketo-buildpacks/nginx/releases/download/v0.0.196/nginx-0.0.196.cnb -b https://github.com/paketo-community/staticfile/releases/download/v0.0.12/staticfile-0.0.12.cnb nginx_helloworld
base: Pulling from paketobuildpacks/builder
Digest: sha256:7fffe76d47effd9affe52089427325819c31e852a646df56c77e6d05c0bc8f66
Status: Image is up to date for paketobuildpacks/builder:base
base-cnb: Pulling from paketobuildpacks/run
Digest: sha256:f084de391a20a9cd1521a9fbeffe782f210fd014d4557eb3cc3bfd56cade69fb
Status: Image is up to date for paketobuildpacks/run:base-cnb
0.10.1: Pulling from buildpacksio/lifecycle
Digest: sha256:37bf981c31303cc022f9f37e079ecd571618a574177dcf2d2b0b19dcb4382c30
Status: Image is up to date for buildpacksio/lifecycle:0.10.1
===> DETECTING
[detector] paketo-buildpacks/nginx 0.0.196
[detector] paketo-community/staticfile 0.0.12
===> ANALYZING
[analyzer] Previous image with name "nginx_helloworld" not found
===> RESTORING
===> BUILDING
[builder] Paketo Nginx Server Buildpack 0.0.196
[builder] Resolving Nginx Server version
[builder] Candidate version sources (in priority order):
[builder] <unknown> -> "*"
[builder]
[builder] Selected Nginx Server version (using <unknown>): 1.19.6
[builder]
[builder] Executing build process
[builder] Installing Nginx Server 1.19.6
[builder] Completed in 721ms
[builder]
[builder] Configuring environment
[builder] PATH -> "$PATH:/layers/paketo-buildpacks_nginx/nginx/sbin"
[builder] Writing profile.d/configure.sh
[builder] Calls executable that parses templates in nginx conf
[builder] Staticfile Buildpack 0.0.12
[builder] Parsing buildpack.yml for nginx config
[builder] Writing profile.d scripts
[builder] Executing build process
[builder] Filling out nginx.conf template
[builder] Completed in 1ms
[builder]
[builder] Configuring environment
[builder] APP_ROOT -> "/workspace"
[builder]
===> EXPORTING
[exporter] Adding layer 'paketo-community/staticfile:staticfile'
[exporter] Adding 1/1 app layer(s)
[exporter] Adding layer 'launcher'
[exporter] Adding layer 'config'
[exporter] Adding layer 'process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] *** Images (cd74a68ef3a4):
[exporter] nginx_helloworld
Successfully built image nginx_helloworld
Note how there is no Nginx layer exported.
If I downgrade to Nginx 0.0.195, it works fine.
pack build -b https://github.com/paketo-buildpacks/nginx/releases/download/v0.0.195/nginx-0.0.195.cnb -b https://github.com/paketo-community/staticfile/releases/download/v0.0.12/staticfile-0.0.12.cnb nginx_helloworld
base: Pulling from paketobuildpacks/builder
Digest: sha256:7fffe76d47effd9affe52089427325819c31e852a646df56c77e6d05c0bc8f66
Status: Image is up to date for paketobuildpacks/builder:base
base-cnb: Pulling from paketobuildpacks/run
Digest: sha256:f084de391a20a9cd1521a9fbeffe782f210fd014d4557eb3cc3bfd56cade69fb
Status: Image is up to date for paketobuildpacks/run:base-cnb
0.10.1: Pulling from buildpacksio/lifecycle
Digest: sha256:37bf981c31303cc022f9f37e079ecd571618a574177dcf2d2b0b19dcb4382c30
Status: Image is up to date for buildpacksio/lifecycle:0.10.1
===> DETECTING
[detector] paketo-buildpacks/nginx 0.0.195
[detector] paketo-community/staticfile 0.0.12
===> ANALYZING
[analyzer] Restoring metadata for "paketo-community/staticfile:staticfile" from app image
===> RESTORING
===> BUILDING
[builder] Paketo Nginx Server Buildpack 0.0.195
[builder] Resolving Nginx Server version
[builder] Candidate version sources (in priority order):
[builder] <unknown> -> "*"
[builder]
[builder] Selected Nginx Server version (using <unknown>): 1.19.6
[builder]
[builder] Executing build process
[builder] Installing Nginx Server 1.19.6
[builder] Completed in 826ms
[builder]
[builder] Configuring environment
[builder] PATH -> "$PATH:/layers/paketo-buildpacks_nginx/nginx/sbin"
[builder] Writing profile.d/configure.sh
[builder] Calls executable that parses templates in nginx conf
[builder] Staticfile Buildpack 0.0.12
[builder] Parsing buildpack.yml for nginx config
[builder] Writing profile.d scripts
[builder] Executing build process
[builder] Filling out nginx.conf template
[builder] Completed in 0s
[builder]
[builder] Configuring environment
[builder] APP_ROOT -> "/workspace"
[builder]
===> EXPORTING
[exporter] Adding layer 'paketo-buildpacks/nginx:nginx'
[exporter] Reusing layer 'paketo-community/staticfile:staticfile'
[exporter] Reusing 1/1 app layer(s)
[exporter] Reusing layer 'launcher'
[exporter] Adding layer 'config'
[exporter] Reusing layer 'process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] *** Images (9887a191668e):
[exporter] nginx_helloworld
Successfully built image nginx_helloworld
Now an Nginx layer is exported.
This doesn't seem to be an issue when just using the Nginx buildpack by itself. I can use 0.0.196 and it works fine. It seems to be just in conjunction with Staticfile. Interestingly, when I run the integration tests for staticfile this doesn't happen either. The integration tests run fine and don't reproduce this problem.
I didn't look into it more, but this change seems like it could be what's causing the change in behavior: paketo-buildpacks/nginx@3648f33.
One thing to think supporting in this buildpack is the ability for users to use Apache HTTP Server to serve static content apps.
Provided the app has a buildpack.yml with the structure below, users would run pack build --buildpack paketo-buildpacks/httpd --buildpack paketo-buildpacks/staticfile
.
Buildpack.yml
staticfile:
httpd:
root: "public"
...... # other keys
Hi there,
the last automatic Release was on 25 Oct 2021.
Since then the Release Process seems to be broken, as you can see here:
"Error: PR 162 has no semver label"
(Example: https://github.com/paketo-community/staticfile/runs/6381340704?check_suite_focus=true)
Looking back at some of the PR's it seems that the bot failed to run the "auto-semver-label" actions:
"You are not logged into any GitHub hosts. Run gh auth login to authenticate. No Github credentials provided."
(Example: https://github.com/paketo-community/staticfile/runs/5724351264)
This leads to missing labels, which leads to the broken Release Tasks.
Could you take a look into this?
The staticfile buildpack does not work with the cnb bionic stack.
We added the staticfile buildpack to cf-for-k8s using the following components:
bionic-image
with this runtime image index.docker.io/paketobuildpacks/run@sha256:c80d5fe8433aea6f3e7dbfd414b56327758f096aea96b06768dd4a172a7f9d5c
cf push is successful and the staticfile app is available via the cf created route
The app failed to start, with this error message:
mkdir() "/client_body_temp" failed (13: Permission denied)
We believe the root cause of this is that the cnb user (from the runtime image) does not have permissions to write to /
.
Related cf4k8s bug: cloudfoundry/cf-for-k8s#587
Staticfile app we pushed: https://github.com/cloudfoundry/cf-acceptance-tests/assets/staticfile (we made a temporary change to this app to add a buildpack.yml file based on the instructions in your staticfile)
We then locally ran docker run -it -p 8080:8080 bash
on the workload image that CF runs, and found these problems:
We updated the listen
field in the server
block to listen on port 8080 -- there was a space between listen
and ;
as if an environment var wasn't set.
We manually started sbin/nginx
with the options -p /tmp
and -c /workspace/nginx.conf
. Also, we had to pre-create /tmp/logs
The app's index file index.html
is in /workspace
but the doc root is /workspace/public
. We created .../public
and copied index.html
into public
.
After making the updates, we were able to run curl localhost:8080
from the command-line and get output (note that when we started the docker container we specified -p 8080:8080
to expose the container's port.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.