I. Housekeeping and first thoughts on configuration
Already back then we decided to offer some sort of customization, so other people can change the behaviour of the platform for their own purposes. While development we also focussed on an easy way to deploy the application (at this time we used Heroku).
As I am revisiting the code some time later I’ve realised that still there are many things hard-coded which are too specific for the usecase in Berlin and also some design choices in how to handle the customization are not completly right.
First I decided to update all dependencies of the project, as the last update is more than one year ago many things changed ( sequelize
database orm), got deprecated or even removed (react-router-redux
for replaced by connected-react-router
).
While this update required touching upon basically every layer of the application, it was good to get in touch with all parts of it again. I used the chance to improve some small things, like debug logging and better linting rules.
Also I changed the build system from gulp
to webpack
, as we had long build times during development (>30 seconds per build) in the end. With webpack
it requires as much time for the first build, but later on its less than a second, which makes development much more convenient of course.
As I changed the build system I realized that some platform configuration is already happening in the asset building process (like setting the Title of the page in the generated index.html). At this point some configuration was handled through an .env
file, which was alright in the past but looks pretty ugly to me now. In the beginning we’ve decided to decouple the webapp from the server strictly, which meant that the whole app was hosted as a static page, nothing was rendered by the server. This was why we had to move some configuration-related tasks already in the building of the application assets.
I decided to move all configuration into a database and decouple system related / low-level configs (database credentials, API keys etc.) from high-level configuration (Title of the page, Dates of the festival etc.). This has to be done in a later step, but as a first preparation I decided to render index.html file server-side and not in the asset building process.
First "housekeeping" steps for upcoming improvements and changes to the codebase:
* Render _index.html_ via `pug` on server-side for easier customization
* Change build system from `gulp` to `webpack`
* Update deprecated `sequelize` methods
* Update all dependencies and asset building pipelines (Babel, scss etc.)
* Replace outdated `react-router-redux` with `connected-react-router`
* Introduce `LOG_LEVEL` env variable for more control over logs, improve `winston` logger
Changes related to this you can find in this PR: Chore: Housekeeping by adzialocha · Pull Request #36 · adzialocha/hoffnung3000 · GitHub