A simple alert board for self-host enthusiasts, startups, ...etc. You can send various messages or alerts to this board via the provided api. This project is still a work in progress, so don't expect it to work right out of the box. It needs some tweaking.
This project uses Yii framework, and a preconfigured app template I created that you can find here: https://github.com/hunwalk/yii2-basic-firestarter/
Also the logo uses an icon I downloaded from here: https://www.flaticon.com/free-icon/wild-boar_427417
Btw, this project looks something like this:
You will need composer for this project. You can find it here, as well as some instructions about how to install it: https://getcomposer.org/
Use the latest release
$ composer create-project hunwalk/board <projectName>
Or use the current master branch, if you're in a hurry for features if there is any
$ git clone https://github.com/hunwalk/board <projectName>
$ cd <projectName>
$ composer install
$ composer run-script post-create-project-cmd
post-create-project-cmd script sets up the permissions for some folders and generates the cookieValidationKey for you
Please note, that this is still in beta, it might not work yet properly. If you've found an error please create an issue on github
Use your favorite terminal and cd into your project.
Then use the command:
php yii serve
And that's it. Open up your browser, head to http://localhost:8080/ and hit install.
Set the vhost's documentRoot to the web folder in this project. That's it.
You can skip this part if you've already used the method above.
Create a .env file from the .env.example
OSX / LINUX
$ cp .env.example .env
Windows
$ copy .env.example .env
- Fill in the .env file. Add or remove things, it's your choice entirely
- Run the following commands
$ php yii migrate-user $ php yii migrate-rbac $ php yii migrate
- Run the server and be happy :)
$ php yii serve
You have 2 options. The first one is to use the board.js provided inside this project. You can find some informations about this on the project page.
You need to send a POST request towards /api/v1/alert/push.
The Content-Type can be either application/json
or application/x-www-form-urlencoded
For the sake of simple demonstration, the body should look like something like this in json:
{
"api_push_key": "<your_project_api_key>",
"type": "html",
"alertName": "Test alert name",
"alertBody": "<p>Test alert body</p>",
"keywords": [
"example-keyword1",
"example-keyword2"
],
"sender": {
"name" : "custom_alert_sender",
"version" : "v0.1"
}
}
The alert type
can be a lot of things, but it basically describes the
alertBody
.
For example "type": "html"
means that the body will be considered as an html.
Type can be: html
, text
, error
, json
If you choose error, make sure you have a stackTraceString attribute inside the object. E.g.
{
"type": "error",
"alertName": "Test alert name",
"alertBody": {
"stackTraceString": "your StackTraceString"
}
}
- How can I create users?
- I've got an RFC complaint error during user creation. What's next?
This project utilizes the dektrium/yii2-user package. Because I still did not created an Installer, you will have to use the console to add yourself in. Use the command:
php yii user/create <email> <username> <password>
If you did not set up the email section of the .env file then probably that is why. To fix this, just fill in these rows like this. Don't worry, this won't send out any emails.
PARAMS_ADMIN_EMAIL=admin@example.com
PARAMS_SENDER_EMAIL=noreply@example.com
PARAMS_SENDER_NAME="John Doe"
In progress
If I left out someone, or something please create an issue, thx.