Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.10 & themes #111

Open
wants to merge 10 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module.exports = {
"@docusaurus/preset-classic",
{
docs: {
lastVersion: "0.9.1",
lastVersion: "0.10",
// Please change this to your repo.
editUrl: "https://github.com/ControlPanel-gg/docs/tree/main/",
},
Expand Down
Binary file added static/img/userguides/themes-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions versioned_docs/version-0.10/Contributing/CTRLPanel Test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
sidebar_position: 4
---

:::info

Please only use CTRLPanel installations that are not modifyed by plugins/modules/scripts or themes.

:::

This repository is using the playwright framework to provide E2E to help developers of the project to speed up development and provide a more stable and secure product.
In case you wanna help by adding some tests, playwright got a awsome documentaion [here](https://playwright.dev/docs/intro) but here are some basics we already took care of so you can start right away.

## Setup
### Requirements
- A setup version of CTRLPanel with the version you wanna test
- A admin account & a user account on this panel
- Basic knowlage of JS (or TS)
- NodeJS 18+

### Instructions
1: clone [this](https://github.com/Ctrlpanel-gg/ctrlpanel-tests) repo
2: run `npm install` to install modules
3: run `npx playwright install` to install playwright browsers
4: rename .env.example to .env
5: populate .env with your data
6: you are ready to go

## Testing
### CLI
`´npx playwright test`
### UI
`npx playwright test --ui`

## Write your own tests
### Simple rules
Because you need to be logged in for almost everything, we already took care of this.
Playwright tests are loaded by regex matches.
To create a test that runs on a user account, name it like so:
```shell
[What is the test testing].[Permissions].[What is this file].js
```
So for example: **server.user.test.js** (Testing servers, with a user account, and its a test)
We setup a _admin_ and _user_ test env this way.

### Make the test
Playwright comes with a codegen funktion `npx playwright codegen`.
With this its easy to get the selection of elements you want quickly and then write the test.
4 changes: 4 additions & 0 deletions versioned_docs/version-0.10/Contributing/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Contributing",
"position": 4
}
40 changes: 40 additions & 0 deletions versioned_docs/version-0.10/Contributing/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 1
---

# Contributing
When contributing to this repository, please go through the open issues to see if you can contribute to something. Suppose you want to contribute something that is not in the issues; you can make an issue and wait for a response from the dev team.

Please note, we have a code of conduct; please follow it in all your interactions with the project.

## Pull request process

1. Give your PR a good descriptive title to immediately view what the PR is about.
2. The dev team will look at your code and approve/merge when possible.
3. Make sure your PR follows our code of conduct and coding style.

## Code of Conduct

### Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

### Coding Style

We are following the PSR12 code standard for PHP.

### Our Standards
Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing other's private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
47 changes: 47 additions & 0 deletions versioned_docs/version-0.10/Contributing/donating.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
sidebar_position: 2
---

# Donating
Are you enjoying the ctrlpanel? Feeling generous? Well, help me and contributors purchase pizza to continue working on the ctrlpanel without empty stomachs!

Your donations go a long way in helping us develop this ctrlpanel, but please don't feel obligated to.<br/>
I will try to mention any donation above €1- in our Discord server.

## Donator Roles
**Ruby Supporter** €50,- + <br/>
**Gold Supporter** €25,- + <br/>
**Silver Supporter** €15,- + <br/>
**Bronze Supporter** €5,- + <br/>
_All Donators with a supporter role will also have access to a Donators Only channel_

Every person that donates above €25- will also get a special place in this document to advertise their site <br/>
Ko-fi link: [https://ko-fi.com/1day2die](https://ko-fi.com/1day2die)
_Please notify me when you've donated, so I can respond quicker :) **1Day2Die#6718**_

## Donators


❤️ Ruby Supporter: **BolverBlitz#4881**<br/>
❤️ Ruby Supporter: **ccrs#4120**<br/>
❤️ Ruby Supporter: **Timo#4042**<br/>
❤️ Ruby Supporter: **Sir Maddigan#0243**<br/>

💛 Gold Supporter: **Wynn#1000**<br/>
💛 Gold Supporter: **dragocz#0191**<br/>
💛 Gold Supporter: **Niktix#3749** [TIX-Hosting](https://tix-hosting.net/)<br/>
💛 Gold Supporter: **DerHorschty#3855**<br/>

🤍 Silver Supporter: **TheFrodoDE#1337**<br/>

🤎 Bronze Supporter: **Grosenberger#5417**<br/>
🤎 Bronze Supporter: **ojacz#5091**<br/>
🤎 Bronze Supporter: **Coconut#7171**<br/>
🤎 Bronze Supporter: **Bazim#0485**<br/>
🤎 Bronze Supporter: **Jonas.#9915**<br/>
🤎 Bronze Supporter: **Vysoký Vagón#3796**<br/>
🤎 Bronze Supporter: **I got 2 phones#8225**<br/>
🤎 Bronze Supporter: **2IceCube#7992**<br/>
🤎 Bronze Supporter: **ᴅᴏᴍɪɴɪᴋ#1005**<br/>
🤎 Bronze Supporter: **DWAA#1660**<br/>
🤎 Bronze Supporter: **ukcai#7121**<br/>
42 changes: 42 additions & 0 deletions versioned_docs/version-0.10/Contributing/translate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
sidebar_position: 3
---

# Translating

You can speak your mother tongue?<br/>
You understand a certain language very well?<br/>
Then we need exactly **you for our translator team!**<br/>

After a long wait, the Ctrlpanel has now been equipped with a translation system.<br/>

_Now we need people who help us translate!_<br/>

## How to help

The Translation list can be found here
https://crowdin.com/project/controlpanelgg

On this Website you will see every language we need to translate and the current progress.
Feel free to contribute or correct any language you know.

If you have a suggestion for a language or want to bring in your skills on a certain language, feel free to contact us on discord!

## Translators

:de: German: **1Day2Die#0849**<br/>
:de: German: **BolverBlitz#4881**<br/>
:it: Italian: **Dotto#8067**<br/>
🇨🇳 Chinese: **Wynn#1314**<br/>
🇨🇳 Chinese: **vlssu#9657**<br/>
🇪🇸 Spanish: **JouRambo#1734**<br/>
🇫🇷 French: **Paulon#9413**<br/>
🇫🇷 French: **Loulou#0088**<br/>
🇮🇳 Hindi: **Anas.#8899**<br/>
🇮🇳 Hindi: **Abraar#7724**<br/>
🇳🇱 Dutch: **Finniedj.exe#9075**<br/>
🇳🇱 Dutch: **EzedOn#6947**<br/>
🇵🇱 Polish: **mibek1011#1318**<br/>
🇷🇺 Russian: **Namaker#2531**<br/>
🇸🇪 Swedish: **Vermium#9649**<br/>
🇵🇹 Portuguese: **Ferks#7575**<br/>
4 changes: 4 additions & 0 deletions versioned_docs/version-0.10/Guides/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Guides",
"position": 4
}
91 changes: 91 additions & 0 deletions versioned_docs/version-0.10/Guides/backups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
sidebar_position: 2
---

# Database backups

All important data is stored in the database. This includes all servers, users, and other information.
It's important to keep backups of your database to ensure that you can restore your panel if something goes wrong.

import TOCInline from '@theme/TOCInline';

<TOCInline toc={toc} />

### How to back up

You can use MySQL dump to back up your database.
This command will create a backup file in the `/var/www/controlpanel/` folder.

```bash
mysqldump -u root -p controlpanel > /var/www/controlpanel/backup.sql
```

### How to restore

To restore a backup, you need a fresh database. If you already have a database, you can use the following command to drop it.

:::warning

Warning, this will delete all Controlpanel related data! Make sure your database is backed up before continuing.
```bash
mysql -u root -p controlpanel -e "DROP DATABASE controlpanel"
```

:::

Then you can restore the backup. You can also restore the backup on any other new server.

```bash
mysql -u root -p
CREATE DATABASE controlpanel;
CREATE USER 'controlpaneluser'@'127.0.0.1' IDENTIFIED BY 'USE_YOUR_OWN_PASSWORD';
GRANT ALL PRIVILEGES ON controlpanel.* TO 'controlpaneluser'@'127.0.0.1';
FLUSH PRIVILEGES;
exit
mysql -u root -p controlpanel < /var/www/controlpanel/backup.sql
```

If you have a backup from an older version of ControlPanel, you have to migrate the database to the latest version.

```bash
cd /var/www/controlpanel
sudo php artisan migrate --seed --force
```

### How to automatically backup

You can automatically back up your database every day at midnight, for example.
First, create a read only user for the database.

```bash
mkdir -p /var/www/controlpanel/backups
mysql -u root -p
CREATE USER 'controlpanelbackupuser'@'127.0.0.1' IDENTIFIED BY 'USE_YOUR_OWN_PASSWORD';
GRANT LOCK TABLES, SELECT ON controlpanel.* TO 'controlpanelbackupuser'@'127.0.0.1';
FLUSH PRIVILEGES;
exit
```

Then create a cronjob to run the following command at midnight.
Run `crontab -e` and add the following line:

```bash
0 0 * * * mysqldump -u controlpanelbackupuser --password=<USE_YOUR_OWN_PASSWORD> --single-transaction --quick --lock-tables=false controlpanel > /var/www/controlpanel/backups-$(date +\%F).sql
```

This will create a backup at /var/www/controlpanel/backups-$(date +\%F).sql every day at midnight.
Every file will have the date when it was made in the filename, so you can also resolve issues that happened a few days ago.

## Appliaction key
The application key is used to encrypt the data in the database, if its lost you will not be able to decrypt the data in the database.

### Backup the application key
To backup the appliaction key you need to get it from the .env file
you can get there with this command:
```nano /var/www/controlpanel/.env```
keep this key safe you will need later!

### Restore the application key
After you have reinstalled the panel go back into the .env
```nano /var/www/controlpanel/.env```
You can then change the new key with the old key!
34 changes: 34 additions & 0 deletions versioned_docs/version-0.10/Guides/products.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
sidebar_position: 1
---

# Products

import DocusaurusImageUrl from '@site/static/img/docusaurus.png';
import useBaseUrl from '@docusaurus/useBaseUrl';

With products, you can configure the resources allocated to new servers created on your panel. You can set the custom pricing and link products to specific nodes and eggs.
You can check out the pterodactyl server creation page for more information about the specific options like CPU and IO.

<img src={useBaseUrl('/img/userguides/product-page.png')} />

### Credits System
Credits are charged hourly based on the monthly price you've configured (price / 30 / 24)
This means that the price of your products won’t be charged right away when the user creates a server, but instead, the credits are reduced hourly—giving the user the option to cancel and create servers freely anytime.
When the user runs out of credits, his server will automatically be suspended.


## Product Linking
<img width="50%" height="50%" src={useBaseUrl('/img/userguides/product-linking-example.gif')} /><br/>
Example of making a product for Minecraft servers.

### Information
Product linking allows you to configure the nodes and eggs this product can be a used on.
For example, you have a node that is more powerful than another node, you may most likely want to charge a bit extra for the usage of this node.
Or you may have a node dedicated for Minecraft hosting and another node for discord bots. Using the node and egg links, you can easily keep your pricing and server creation separated.

### Hiding nodes and eggs
You can hide specific nodes or eggs from being used by not configuring them in any of your products. This way, they won’t show up in the server creation page and therefore can’t be used by your customers. This is great if you have some nodes or eggs that you want to exclude from Ctrlpanel.

### Tips
If you have a well-configured product, you can use the Copy button to copy the product to create slight variations of it easily :)
56 changes: 56 additions & 0 deletions versioned_docs/version-0.10/Guides/themes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
sidebar_position: 4
---

import DocusaurusImageUrl from '@site/static/img/docusaurus.png';
import useBaseUrl from '@docusaurus/useBaseUrl';

# Themes

import TOCInline from '@theme/TOCInline';

<TOCInline toc={toc} />

## Install a theme

:::info
You should always follow the instructions of the theme you want to install.
:::

Most themes are installed by placing files in the `/themes` and `/public/themes` folders.

Then you can select the theme in your `settings > system > design`
<img src={useBaseUrl('/img/userguides/themes-page.png')} />

## Create a theme

### Basic setup
Ctrlpanel.gg uses the module [laravel-themer](https://github.com/qirolab/laravel-themer).
To start creating your own theme run the following command
```sh
php artisan make:theme
```
This will ask you some basic questions and will setup a base for you to start with.

### Bladefiles & layout
Now you can find a copy of the original default theme files in the new folder the command above just created.
You should start by modifying those two files first because those are responsible for the main layout of the dashboard.
`/themes/<YourThemeName>/views/layouts/app.blade.php`
`/themes/<YourThemeName>/views/layouts/main.blade.php`

### CSS
You can create a new folder in `/themes/<YourThemeName>/app.css` with your own custom CSS.
Import the CSS in your blade files with the following line
```blade
<link rel="stylesheet" href="{{ asset('themes/<YourThemeName>/app.css') }}">
```
and remove the line
```blade
@vite('themes/default/sass/app.scss')
```

### Sharing the theme (Optional)
Make sure you include both the `/themes` and `/public/themes` folder and a file to guide other users on how to install your theme.
Keep the installation instructions as simple as possible and verify you didn´t forget anything, no matter how small the step might seem to you.

You can upload your theme to our [Market](https://market.ctrlpanel.gg/) or share it however you like.
Loading