victronenergy / victron-press

Based on vuepress - this a set of tools to maintain and publish documentation using md as a source format
1 stars 1 forks source link

Victron Energy documentation

last release build status

Overview

This repository houses two applications: The frontend, which is written using VueJS, and the backend, which is written in PHP. They are meant to be deployed together on a single webserver. The (built) frontend provides all the rendered documentation files, and the backend handles all routing for non-existant paths.

This repository contains the application, while another repository (namely, www-documentation) contains the Markdown files and accompanying images which make up the actual documentation.

Requirements

To check the tools have been set up properly, check that you can run git version, node -v, npm -v, php -v and composer -V from a command terminal.

Execute the following commands in the (new, empty) directory where you want to set up the project:

Environment variables

The following environment variables should be provided (for example via the .env file) for the application to work:

Running with Docker

Alternatively, a Dockerfile is included which includes all the runtime dependencies for the project. To use it:

Frontend

The frontend is a VuePress application that renders the documenation and provides editor functionalities.

Building and running

There are multiple ways to work with the frontend part of the repository:

Backend

The backend is a PHP application that handles routing of non-existing paths and provides an API used by the frontend to read and commit documentation files.

Building and running

There are multiple ways to work with the backend part of the repository:

Application structure

Directory layout

Configuration files for Composer, npm, Docker, Git, tests and linters are placed in the root directory.

Example request flow

In this exampel we'll be editing myfile.md.

Production deployment

In production a GitHub machine user is used for committing and pushing changes to the www-documentation repository, as well as pulling the latest code and documentation from GitHub and deploying it to the production web server.

Note for developers

Always aim to leave the code in a better state than you found it in.

All new functionality should have test coverage and commits should be linted, which you can check with the composer test, npm test, composer lint and npm run lint commands. Some linting issues may be resolved automatically using composer fix and npm run fix.