Giter Site home page Giter Site logo

timanovsky / subdir-heroku-buildpack Goto Github PK

View Code? Open in Web Editor NEW
523.0 9.0 326.0 7 KB

Allows to use subdirectory configured via environment variable as a project root

Home Page: https://medium.com/@timanovsky/heroku-buildpack-to-support-deployment-from-subdirectory-e743c2c838dd

Shell 100.00%
heroku-buildpack heroku

subdir-heroku-buildpack's People

Contributors

edmorley avatar timanovsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

subdir-heroku-buildpack's Issues

PROJECT_PATH is undefined?

I can't tell if this is Heroku or something else... but it does not seem to be picking up my PROJECT_PATH environment variable?

-----> Subdir buildpack app detected
PROJECT_PATH is undefined
 !     Push rejected, failed to compile Subdir buildpack app.
 !     Push failed

But it's clearly defined:
image

I've gotten this to work in other Heroku apps. The only difference here is that this repo is changing to a subdirectory folder structure.

Any thoughts? This is baffling to me.

Incompatible with in-dyno PostgreSQL

Just want to leave this here: this buildpack is incompatible with the new in-dyno variant of heroku-postgresql addon for Heroku CI. So in your app.json, you have to use the standard

"addons": ["heroku-postgresql"]

Alternatively, you could switch to heroku-buildpack-select-subdir which doesn't delete everything except the project path, allowing in-dyno postgres to work.

still deploying front end

I have followed all of the steps in the article about using this build pack to deploy a subfolder on heroku. However, it continues to deploy my entire app. I only want my backend/ folder deploying on heroku, not my entire repo but it seems like its not working that way. Is it still supposed to respond to code changes in the entire app, but only be showing the server code in the deployment, or is it not supposed to be responding to the front end at all?

repository_name/
├─ backend/
├─ frontend/

CONFIG_VAR SETUP

PROJECT_PATH: backend

Everything but project root deleted

Set PROJECT_PATH environment variable to point to project root. It will be promoted to slug's root, everything else will be erased.

This doesn't work for my project—I have a server in backend, and static files in frontend that I'd like the server to be able to run. But using this buildpack causes everything in frontend to be deleted. Is this just an unsolvable Heroku limitation?

Register in buildpack registry

My name is Jon Byrum and I’m a product manager at Heroku. Your buildpack is one of the top 200 most popular buildpacks on Heroku!

I would like to invite you to publish your buildpack early in our Buildpack Registry, before it is made available to the general public (expected early July).

To register your buildpack, visit: https://addons-next.heroku.com/buildpacks
Documentation: https://devcenter.heroku.com/articles/buildpack-registry

Why register?

  • By registering early you’ll be able to grab your preferred namespace for the buildpack
  • After registering, your buildpack will be available to all Heroku users when they run heroku buildpacks:search. In the future, we will only display registered buildpacks on elements.heroku.com/buildpacks
  • The Buildpack Registry makes it easy for you to publish a new version of your buildpack, as well as roll back if there are errors

Recommended naming conventions:

  • We recommend that you use the same namespace (e.g., jbyrum) with Buildpack Registry that you use on GitHub
  • In general, avoid using "buildpack" in the name of your registered buildpack
    • For example: If your Github repo is github.com/foobar/heroku-buildpack-elixir, then we recommend a name like "foobar/elixir"

It would be greatly appreciated if you could publish before June 18th, as we prepare to make the feature publicly available. Registering a buildpack should take approximately 5 minutes.

If you have any questions about registering (or run into any issues), please email:
[email protected]

Shared folders support

Hi,
our current directory structure looks like
web/...
api/...
sdk/...
where api and web load code from sdk. The issue i have is that when trying to load the sdk from the web or the api projects, it just breaks because sdk is removed.
I thought maybe there already was a configuration option, but i looks like this buildpack just removes everything.
Do you have an existing solution or could i try to implement a feature to keep some paths in the directory ? It would be greatly appreciated :)
Thanks for this buildpack anyway, solved many of my issues.

Buildpack warnings when building in /app ("rm: cannot remove '/app': Read-only file system")

Hi

I'm on the team that maintains Heroku's build system and official buildpacks, and wanted to let you know about a future incompatibility with this buildpack (which is one of the most popular of the sub directory/monorepo style buildpacks).

The directory in which the Heroku build system performs builds is currently a path like/tmp/build_<hash>.

In the near future this path will be changing to /app so that the build-time and run-time app locations are the same path - in order to resolve a number of long standing bugs, and reduce the number of hacks buildpacks have to use to work around non-relocatable languages/toolchains.

One side-effect of this build directory change is that it will no longer be possible to rm -rf $BUILD_DIR since that will now be equivalent to rm -rf /app, and due to the way slugs are mounted inside a dyno, the /app directory is read-only (not the contents of the directory, only the directory listing itself).

As such once this change comes into effect this buildpack will output Read-only file system warnings like so:

remote: -----> Subdir buildpack app detected
remote: -----> Subdir buildpack in frontend
remote:        creating cache: /tmp/codon/tmp/cache
remote:        created tmp dir: /tmp/codon/tmp/cache/subdirXF9Kh
remote:        moving working dir: frontend to /tmp/codon/tmp/cache/subdirXF9Kh
remote:        cleaning build dir /app
remote: rm: cannot remove '/app': Read-only file system
remote:        recreating /app
remote:        copying preserved work dir from cache /tmp/codon/tmp/cache/subdirXF9Kh to build dir /app
remote:        cleaning tmp dir /tmp/codon/tmp/cache/subdirXF9Kh
remote: -----> Discovering process types
remote:        Procfile declares types -> (none)
remote:
remote: -----> Compressing...
remote:        Done: 191B
remote: -----> Launching...
remote:        Released v6

Due to this line:

rm -rf $BUILD_DIR

The build won't actually fail, since bin/compile doesn't use bash exit on error (#8). Conveniently, the build output result will actually still be correct, since the rm -rf $BUILD_DIR will still remove all of the other files in /app even though it fails to remove /app itself.

As such, this is more of a warning than an error, though it might lead people to think the buildpack isn't working.

In order to prevent the warning, the buildpack needs to instead delete only the contents of the directory, not the directory root - I'll open a PR for that now.

PROJECT_PATH is undefined

This is what I get when I follow the steps listed in the README.md

-----> Subdir buildpack app detected
PROJECT_PATH is undefined
! Push rejected, failed to compile Subdir buildpack app.
! Push failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.