CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 240
Outdated Docker Documentation for v4.3
THIS DOCUMENTATION IS OUTDATED. READ LATEST
Thanks to @Nevexo, one of the contributors for the project, starting with cState v4.3 there is official Docker support.
We still recommend using cState as a serverless option because the author of cState can attempt to give support and guidance. This is just an alternative for effectively what is dynamic hosting instead of the standard static hosting.
Adding a Dockerfile allows cState to operate without a serverless system, such as Netlify, but also makes development a little easier as you don't need to install the required dependencies onto your machine, such as Hugo. This can make development on non-UNIX based systems a little easier and removes the requirement of installing Hugo to develop cState.
Docker support is achieved with two new files: Dockerfile
& docker/entrypoint.sh
.
- The Dockerfile configures the Docker image, pulls cState and configures it for first run.
- The Dockerfile will clone the example repo into the working directory & then install the files from this repo on top of it, this method could be improved in the future, but this solution allows the Dockerfile to work on the development environment, rather than using the submodules within the example repo.
- The entrypoint script file exists to build cstate on every startup. This is required as all files are compiled into the public directory. Once building is finished the public files are moved into NGINX's working directory and the server starts.
— @Nevexo
-
Clone the repo:
git clone https://github.com/cstate/cstate
-
Build the Docker image:
cd cstate/
docker build -t cstate .
-
Run the container (mount):
docker run -p 8080:80 --mount type=bind,source=/var/cstate,target=/app --name=cstate cstate
The above command will create a directory in /var called 'cstate' this is where all files will exist for modifying the issues & templates of cState, the NGINX server will listen at port 8080.
- Run the container (volume)
docker run --rm -p 8080:80 -v cstate:/app --name=cstate cstate
This command will create a new docker volume. This isn't recommended as modifying the files within a volume can be tricky. The volume will be named 'cstate' and the NGINX server will listen at port 8080.
The easiest way to reload cState after modifying it's files is to run docker restart cstate
as the container will also recompile the files on startup.
If restarting the container is not an option, you can use docker exec -it cstate /bin/ash
to launch a shell into the container, and then use the following commands:
cd /app
hugo
cp -r /app/public/* /usr/share/nginx/html
This will rebuild cState and copy the files back into the NGINX directory.
- NGINX is downloaded with Alpine Linux
- cstate/example is downloaded
- cState source files are copied into /themes/cstate
-
hugo
is run against the source files - The /cstate/public folder is copied into the
www-data
folder of NGINX - NGINX starts
And now cState is up with Docker, NGINX.
The Docker file first sets up a little Linux server that comes with NGINX. Then there's a line RUN apk add hugo
which then stalls hugo
. The Docker file also copies the entrypoint script into the startup folder of the container, so when the container starts, it runs hugo
on the source files and compiles everything that was compiled into the running directory of NGINX so that it can be accessed.
Still can’t find help? Open issue →
Like cState? Please star it and share it with people who might find it useful!
Use the README to get some basic information about cState.
- cState Core (you are here)
- cState HTML Embed
- cState CLI
- cState Monitor Bot
Please note the Monitor Bot and CLI tools work best with cState version 6 and up.
- Method 1 - Create a new file manually
- Method 2 - Create incident with CLI / SSH
- Method 3 – Create incident from Web UI
Create incidents automatically – Setting up monitoring
Announcing maintenance. Informational posts (pinned or not) [v5.2+]
- Changing site name
- Changing site URL
- Changing site language
- Changing site description
- Changing date formats (v3.0)
- Tabs
- Google Analytics
- Disable complex calculations (v4.1)
- Hiding incident history (v4.2)
- Customize incident history display (v6)
- Uptime histogram (v6)