MattMattV / HostMyDocs

Small web server use to host documentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HostMyDocs

Docker Pull License: GPL v3 Build Status

Small web application to quickly access all your documentation !

Screenshot of HostMyDocs

Before Starting

Note that by default the BackEnd will require to be secured with HTTPS. If you want to be able to add documentation via unsecured HTTP you will need to pass the SHOULD_SECURE=FALSE environment variable to your container.

You can refer to the production setup section to properly deploy an HostMyDocs instance with SSL enabled.

Getting Started

Add a doc

  1. Launch the application and its server with docker run -e CREDENTIALS=user:password -e SHOULD_SECURE=FALSE -v `pwd`:/data -p 8080:80 tracesoftware/hostmydocs

  2. Put all the documentation files and the index.html file into a folder

    It should looks like this :

        documentation <- top folder that you will zip next
        ├── images
        ├── index.html
        ├── injectables
        └── styles
    
  3. Zip that folder ! (by example zip -r docs.zip documentation)

  4. Now upload it with cURL by example :

curl --request POST \
  --url http://localhost:8080/BackEnd/addProject \
  --user user:password \
  --header 'content-type: multipart/form-data;authorization: Basic dXNlcjpwYXNzd29yZA==' \
  --header 'boundary=---011000010111000001101001' \
  -F "name=DocumentationName" \
  -F "version=1.0.0" \
  -F "language=YourProgrammingLanguage" \
  -F "archive=@docs.zip;type=application/zip"
  1. Open http://localhost:8080 to see your uploaded docs !

Delete a doc

  1. Launch the application and its server with docker run -e CREDENTIALS=user:password -e SHOULD_SECURE=FALSE -v `pwd`:/data -p 8080:80 tracesoftware/hostmydocs

  2. delete using cURL by example :

curl --request DELETE \
    --url http://localhost:8080/BackEnd/deleteProject \
    --user user:password \
    -d "name=DocumentationName" \
    -d "version=1.0.0" \
    -d "language=YourProgrammingLanguage"

Note that you can write

-d "language="

to delete a whole version for the project

OR

-d "version=" \
-d "language="

to delete the whole project

  1. Open http://localhost:8080 to see your remainings docs !

BackEnd API

You can visualize it in the Swagger editor

Production setup

You only need to put the System folder on your server to be able to deploy the application.

First, you must modify the System/.env file to change the default credentials that are not secure.

Then, you can execute the System/install.sh script. It will register a hostmydocs.service in systemctl so you can easily access to logs.

If you want to upgrade the application, just run System/install.sh again !

SSL management

The container provide two volumes, so you can mount your certificate and your private key

  • /etc/ssl/certs/ssl-cert-snakeoil.pem
  • /etc/ssl/private/ssl-cert-snakeoil.key

Development

FrontEnd

  1. Open a terminal at the root of the project

  2. Build a local Docker image of HostMyDocs : docker build -t hmd .

  3. Start a Docker container containing the BackEnd : docker run -p 3000:80 -e CREDENTIALS=user:password -e SHOULD_SECURE=FALSE -v `pwd`/BackEnd:/var/www/html/BackEnd hmd

  4. Start the Webpack dev server : cd FrontEnd && yarn start

  5. Open http://localhost:8080 to see your changes automatically refreshed

  6. Now you can develop with your favorite editor/IDE !

About

Small web server use to host documentation

License:GNU General Public License v3.0


Languages

Language:PHP 53.1%Language:TypeScript 36.2%Language:HTML 5.9%Language:Dockerfile 1.9%Language:JavaScript 1.8%Language:Shell 0.7%Language:CSS 0.5%