Now I am searching Heroku, which is a famous Paas platform. And here is one question about the internal structure, especially a relationship between a buildpack and a slug compiler.
In public statement,
"Buildpacks are responsible for transforming deployed code into a slug, which can then be executed on a dyno. Buildpacks are composed of a set of scripts, and depending on the programming language, the scripts will retrieve dependencies, output generated assets or compiled code, and more. This output is assembled into a slug by the slug compiler."
And in "Leaning Heroku Postgres", which is a book introducing Heroku's details and published by PACKT enterprise, the author says "the slug is created by the slug compiler and its core is a collection of scripts called a buildpack."
So, what does buildpack do in Heroku? In the former statement, it is supposed to transform deployed app into a slug and in the later one buildpack is the core of the slug compiler which is supposed to create a slug.
Which creates a slug, the buildpack or the slug compiler?
In Heroku, the buildpack generates the slug. It is the 'slug compiler'. I think you're getting a bit caught up on the terminology here though.
The way Heroku works is quite simple:
When you push your code to Heroku, a buildpack runs and installs dependencies, caches static assets, etc.
The buildpack then puts all of this into what is essentially a zipfile on Amazon S3.
When a dyno starts up, Heroku downloads the zipfile from S3 with everything that's needed (your app dependencies, source code, etc.), then starts the server up.
That's basically it!
Related
I'm trying to deploy a webapp to Heroku. The current stack is build out of:
NextJS for the frontend (deployed on Vercel)
Strapi CMS (deployed on Heroku)
I would love to add a webshop to the webapp and would love to use the example from Vercel/commerce (https://github.com/vercel/commerce). I have selected Vendure as my favorite headless commerce provider.
I have a problem figuring out how to deploy Vendure on Heroku-platform. Is it possible to combine both Strapi and Vendure on only one Heroku app? Can both programs work together? I would think it's possible because both can work with PostgresDB.
I've read this documentation (https://www.vendure.io/docs/developer-guide/deployment/) but this doesn't speak about Heroku and the combination with Strapi.
I know my way with NextJS / Javascript / HTML, but my knowledge of the backend and deployment is not as good.
Thanks in advance for helping me out.
Greetings,
Bruno
You could take a look for inspiration/pointers at the vendure/vendure-demo repo, it is deployed using dokku, which is a nice FOSS heroku-like deployment app for your VPS or Server.
If you want, you could use it's Dockerfile for running it in heroku likewise or whatever dokcker compatible provider you might choose, just remove the -demo- parts you don't need about it.
I also have successfully deployed vendure and commerce with CapRover. Can recommend it a lot!
Which is like dokku but with a nicer webapp GUI/Installation. If you go the dokku route you have ledokku for a GUI too. Not so polished though.
I'm in the process of deploying my Rails app (it also uses redux, react, as well as some Ruby and Javascript). And I'm on the step in the official Heroku guide where it specifies to add a Procfile.
I assume that these are the commands that will run once the apps starts up; what exactly do I need to put in here for a Rails app that uses a database?
Locally, I know that to start my app I run rails s, as well as setting up the database beforehand; do I need to do something like that in the Procfile?
Right now, I am running a Vue app within a phoenix app. I first created a phoenix project and then started a Vue app with the name of assets.. for running it in the development environment. I have added
watchers: [npm: ["run", "build", cd: Path.expand("../assets", __DIR__)]]
which each time creates a build which is being used in app.html.eex from priv/static..
and For deployment, I am using phoenix static build pack.. which in production before deploy creates a build before ahead and then run phoenix app. everything is working fine. but its wrong way due to which..
overall benefits of Vue application is not being availed. e.g code splitting/loading code chunk on-page request only. and many other webpack features which we can avail within a Vue app are all not being availed as we just creating the build and putting it in production.
My issue is that. I have seen in may tutorials that run a Vue app with your API as a proxy. and so that the main app will be Vue and Phoenix API will work behind a proxy.
Right now I have this setup to deploy and work in development mode. My question is how I can achieve the opposite to that?
Starting Vue application which will automatically start the phoenix app as well. Also for deploying on Heroku. API will run simply but Vue app will for more functional than just a JS or CSS file static files?
Update: Is it possible to make an umbrella application in which one is Vue and one is phoenix?
This is more of an extended comment, but it was getting really big so I moved it to an answer.
To start two or more apps you will need something like foreman (in heroku, I think there's a buildpack with it) or systemd, or even start a nodejs server from your elixir app (not sure this is doable in heroku).
You can also split manually your components through the webpack config used by phoenix, this can be a bit more involved than just serving a single js file. The reason to split it into two separate services needs to be thought of, but this is usually achieved (if I'm not mistaken, it's been a while since I used it in this way) with having different entry points. For webpack to work the best with splitting assets (css&others) you'll need to also write your vue components in a way that webpack can then understand the dependencies (at least this was the case - and there might be some complexities with the webpack chunking and phoenix digest when using dynamic components, etc).
Other option is to, for instance, use an independent nuxt app, which bundles up a VueJS app with everything you need, webpack, server, vuex, a sensible config and "structure" etc. Now you have two distinct applications, running each an http server, you use asyncData & fetch to populate/hidrate your front-end with data from the phoenix app, you can use async components and all that stuff. Then you deploy the front-end (nuxt app) to one heroku instance and the phoenix server on other instance or somewhere else.
At that point your phoenix app is basically an api for the front-end. So the vue app has to be built with that in mind, and now you've got 2 applications to deploy&take care of. It does help in a lot of fronts but it's also more complexity (authorization, cookies, etc), hence why it needs to be weighted if it's worth doing it. The major benefit is that since they're now 2 apps, styling and things related to the front-end can be deployed without needing to re-deploy the back-end.
Depending on the type of front-end you can also deploy the nuxt app as a static website to something like s3/cloudfront or any other cloud storage engine. For instance if you have like, X public pages that are all mostly static content and everything that is dynamic data is behind a login wall or something, then that is a solution that works fine too.
All 3 ways are valid depending on what you need/reason to do it.
Let's assume I have staging and production versions of my application. I want staging version should be accessible only to specific people like developers, testers. Do we have that kind of configuration on Heroku like deployed address can be only accessed by users have some key.
There is nothing like this in the Heroku product at this time. You would need to handle this as part of your application in some way.
For my project, I would like to be able to setup multiple websites (App) and according to the requirements from a clients, I will activate and setup modules. Those modules could be a news module, images viewer module and so on.
My engine, which consist of scripts and libraries that manage a few things such as the WebApp routing, the modules, user rights for the CMS. I would like to get this code shared among all my App to avoid unseless duplication.
I would like to know what's the best way to do this on Heroku since I am totally new to this (Heroku) and I am not totally sure if that is feasable.
Also, am I wrong to believe that each websites is an App even if basically the only difference between them are the template and a single setup file?
Thank you
If you have no experience with git get familiar with it.
I would suggest to have one application with different branches in which you keep the configuration specific to the instance.
You create an app instance for each website.
You push the specific branch to the specific app, e.g.
git push git#heroku.com:.git :master