Skip to content

Add a 'Deploy to Heroku' button#1285

Open
daneov wants to merge 4 commits into
alextselegidis:masterfrom
daneov:master
Open

Add a 'Deploy to Heroku' button#1285
daneov wants to merge 4 commits into
alextselegidis:masterfrom
daneov:master

Conversation

@daneov

@daneov daneov commented Jul 11, 2022

Copy link
Copy Markdown

Goal of this PR

To facilitate easy deployment to Heroku, and perform the changes needed to make that possible.
This PR resolves #1284.

Individual commits

  1. 9894295 - Set up GitHub CI so that a fork has a minimal pipeline. I was unable to get composer test running, and don't know why there were so many deletions in the package.json file, but everything still works.
  2. cb2de13 - Mixing composer and node in 1 environment is not possible in Heroku, since they provide buildpacks, specialised environment for building either node or php environments.
    I've used the environment variable CI to distinguish between Heroku and another environment, since they commonly set that to indicate a CI environment. Not making this distinction would result in a failing build at Heroku because the binary composer would not be present in a node environment.
  3. ae83bd6 - Use environment variables to customize SMTP settings so they can be customised as well
  4. 92ac98d - Contains the meat of the change. I tried to explain the different aspects in the commit message

daneov added 4 commits July 9, 2022 18:05
This allows someone that forks this repository to download the
bundled package from his build as an artifact for easy inspection.
GitHub CI has both installed, but not every system does so - Heroku
Heroku uses 'buildpacks' which contain tools needed to build an
application for a given technology, but allow little customization
and have a pre-set number of tools included (or I haven't found a
way to include both `composer` and `node` in 1 environment, short
of defining such a build environment by hand).

This is why we need to invoke 2 seperate buildpacks sequentially:

1. `composer install``
2. `npm run build`

Defining the environment variables like this allows the developer to
easily fill in the required values with minimal overhead.

Heroku heavily uses environment variables to configure applications,
and doesn't allow for after-deployment adjustments.

Using environment variables for configuration does not fit into
the current way the config is set up since this uses constants,
which need to be fixed at the start of the program.

This leads us to the following 2 points:

1. Since these are constants, they cannot be read directly from the
environment and we have to perform an in-file replace to make them
active.
2. A change in environment variables triggers a restart of a dyno,
but not a redeploy. This means that we cannot configure these at
build, so we have to perform this change when a Dyno is (re)started.

The [.profile](https://devcenter.heroku.com/articles/dynos#the-profile-file)
file allows us to manipulate the environment and files for the Dyno,
or runner, allowing us to alter the `config.php` file and apply
the desired config, while still sticking to non-mutable configuration
once the application is booted..

We also need a custom logger to propagate the CodeIgniter logs
towards Heroku.

See https://devcenter.heroku.com/articles/php-logging#codeigniter-3-x
@daneov

daneov commented Jul 11, 2022

Copy link
Copy Markdown
Author

@alextselegidis:
These changes can be tested from the fork: https://github.com/daneov/easyappointments, which now includes the Deploy to Heroku-button

@daneov daneov changed the title Facilitate deployment to Heroku Add a 'Deploy to Heroku' button Jul 12, 2022
@alextselegidis

Copy link
Copy Markdown
Owner

Hello!

Thanks for this PR!

Let me check this out and get back to you.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

@daneov

daneov commented Aug 10, 2022

Copy link
Copy Markdown
Author

@alextselegidis just a ping so this is not forgotten. Hope you're having a good time 👋🏼

@alextselegidis

Copy link
Copy Markdown
Owner

Thanks!

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

@daneov

daneov commented Jan 9, 2023

Copy link
Copy Markdown
Author

Not sure if this one is forgotten or not, but closing it due to inactivity.

@daneov daneov closed this Jan 9, 2023
@alextselegidis

Copy link
Copy Markdown
Owner

Hi @daneov, I'd still want to take a look on this one.

Let me keep this alive :)

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

@alextselegidis alextselegidis reopened this Jan 9, 2023
@daneov daneov closed this Apr 15, 2023
@daneov daneov reopened this Apr 15, 2023
@daneov

daneov commented Apr 15, 2023

Copy link
Copy Markdown
Author

That was accidental, please ignore.

@johnpg82

johnpg82 commented May 1, 2023

Copy link
Copy Markdown

Any word on this change?

@alextselegidis

Copy link
Copy Markdown
Owner

Hello! I'll write back on this one soon.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a "Deploy On Heroku" button in README.

3 participants