mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
pakcages
This commit is contained in:
7
website/docs/articles/docker/_category_.json
Normal file
7
website/docs/articles/docker/_category_.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"label": "Docker",
|
||||
"position": 10,
|
||||
"link": {
|
||||
"type": "generated-index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
# Building a Custom Docker image: pre-install IonCube Loader
|
||||
|
||||
Docker images are a base for every OpenPanel plan, and they define what Technology Stack is pre-installed for the user.
|
||||
|
||||
If you need something pre-installed or configured for all users on a plan, like the ionCube loader extension for the installed PHP version, follow these recommended steps:
|
||||
|
||||
1. Download example Docker image files.
|
||||
2. Edit to include the new configuration/service.
|
||||
3. Create the Docker image.
|
||||
4. Create a new plan to use the image.
|
||||
5. Test: create a new user on that plan.
|
||||
|
||||
### Download Docker Examples
|
||||
|
||||
Currently, we provide and maintain 2 Docker images, one that uses Nginx and the other with Apache. Download the image files that you want, either nginx or apache:
|
||||
|
||||
For Nginx:
|
||||
```bash
|
||||
git clone -n --depth=1 --filter=tree:0 \
|
||||
https://github.com/stefanpejcic/OpenPanel/tree/main/docker/nginx
|
||||
cd OpenPanel
|
||||
git sparse-checkout set --no-cone docker/nginx
|
||||
git checkout
|
||||
```
|
||||
|
||||
For Apache:
|
||||
```bash
|
||||
git clone -n --depth=1 --filter=tree:0 \
|
||||
https://github.com/stefanpejcic/OpenPanel/tree/main/docker/apache
|
||||
cd OpenPanel
|
||||
git sparse-checkout set --no-cone docker/apache
|
||||
git checkout
|
||||
```
|
||||
|
||||
|
||||
After downloading the source files, there should be:
|
||||
- **Dockerfile**: This file defines the software stack of the image and is used only to build the image.
|
||||
- **entrypoint.sh**: Used by OpenPanel to monitor users' services status and versions, such as tracking the random IP of users' Docker containers, status of Redis/Memcached services, PHP versions installed, etc. This file is essential and should not be modified. It is executed on every restart of the user container.
|
||||
- **my.cnf**: A MySQL service configuration file for customizing MySQL limits and settings.
|
||||
- **pma.php**: A configuration file for phpMyAdmin to enable passwordless login from OpenPanel to phpMyAdmin.
|
||||
|
||||
### Edit Dockerfile
|
||||
|
||||
In this example, we will be adding the ionCube loader PHP extension to the image so that the pre-installed PHP 8.3 version already has ionCube enabled.
|
||||
|
||||
Open the **Dockerfile** with a text editor:
|
||||
|
||||
```bash
|
||||
nano Dockerfile
|
||||
```
|
||||
|
||||
Inside, include steps to download the ionCube extension and include it in the php.ini file for both CLI and FPM service.
|
||||
|
||||
First, add the part to download the extension. Ensure this is added after PHP install:
|
||||
```bash
|
||||
#download for PHP 8.3
|
||||
RUN mkdir -p /usr/local/lib && curl -sSlL -o /tmp/ioncube.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && tar -x --strip-components=1 -C /usr/local/lib -f /tmp/ioncube.tar.gz ioncube/ioncube_loader_lin_8.3.so
|
||||
```
|
||||
|
||||
This downloads the extension from the ionCube website and adds it to the folder.
|
||||
|
||||
Now, add the part to include it in the php.fpm files:
|
||||
|
||||
```bash
|
||||
# add for phpfpm service
|
||||
RUN (echo 'zend_extension = /usr/local/lib/ioncube_loader_lin_8.3.so' && cat /etc/php/8.3/fpm/php.ini) > /etc/php/8.3/fpm/php.ini.new && mv /etc/php/8.3/cli/php.ini.new /etc/php/8.3/fpm/php.ini
|
||||
|
||||
# add for cli
|
||||
RUN (echo 'zend_extension = /usr/local/lib/ioncube_loader_lin_8.3.so' && cat /etc/php/8.3/cli/php.ini) > /etc/php/8.3/cli/php.ini.new && mv /etc/php/8.3/cli/php.ini.new /etc/php/8.3/cli/php.ini
|
||||
```
|
||||
|
||||
|
||||
That Is it. Save the file and exit.
|
||||
|
||||
### Create Docker image
|
||||
|
||||
After adding the commands to download and install the ionCube loader, we now need to build a Docker image from the files.
|
||||
|
||||
Depending on the downloaded example, replace `nginx` or `apache` in this command:
|
||||
|
||||
```bash
|
||||
docker build . -t my_custom_nginx_image
|
||||
```
|
||||
|
||||
Make sure that the name contains either `nginx` or `apache`, as this is used by OpenPanel to determine the features to display to the user on their interface.
|
||||
|
||||
If the build fails, there will be an error message indicating which exact line caused the error. That line needs to be edited and the build repeated.
|
||||
|
||||
After successfully building the image, the next step is to create a new OpenPanel hosting plan to use it.
|
||||
|
||||
### Create Hosting Plan
|
||||
|
||||
Currently, new hosting plans with custom images can only be added from the terminal.
|
||||
To create a new plan, run the following command:
|
||||
|
||||
```bash
|
||||
opencli plan-create <NAME> <DESCRIPTION> <DOMAINS_LIMIT> <WEBSITES_LIMIT> <DISK_LIMIT> <INODES_LIMITS> <DATABASES_LIMIT> <CPU_LIMIT> <RAM_LIMIT> <DOCKER_IMAGE> <PORT_SPEED_LIMIT>
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
opencli plan-create cloud_8 "Custom plan with 8GB of RAM&CPU" 0 0 15 500000 0 8 8 my_custom_nxinx_image 200
|
||||
```
|
||||
|
||||
### Create new user
|
||||
After creating a plan that uses our newly built Docker image, the final step is to create a new user on the plan to test that the ionCube loader is indeed enabled.
|
||||
|
||||
Create a new user from the OpenAdmin interface or via terminal:
|
||||
```bash
|
||||
opencli user-add <USERNAME> <PASSWORD> <EMAIL> <PLAN_NAME>
|
||||
```
|
||||
|
||||
Example:
|
||||
```
|
||||
opencli user-add stefan strongpass123 stefan@pejcic.rs cloud_8
|
||||
```
|
||||
|
||||
After creating the user, log in to their OpenPanel and confirm that the extension is enabled by opening the PHP.INI editor or by creating a php.info file and searching for the ionCube loader.
|
||||
@@ -0,0 +1,28 @@
|
||||
# High physical memory usage for new OpenPanel accounts
|
||||
|
||||
OpenPanel uses [Docker images](#) as a base for every user. We provide and maintain two official images that both use Ubuntu24 and Nginx or Apache webserver.
|
||||
|
||||
These images are optimized for both speed and performance, and new idle accounts will use from 10-150mb of RAM - depending if using Debian or Ubuntu as server OS.
|
||||
|
||||
If you want to fine tune the performanse and lower RAM usage for idle accounts, you can create a custom Docker image that will have only the services that you offer pre-installed.
|
||||
|
||||
Here is an example guide on creating a custom docker image:
|
||||
|
||||
|
||||
## How OpenPanel uses RAM
|
||||
|
||||
When new user is created, it has a Ubuntu24 OS that has only PHP running. A unique feature of OpenPanel is that additional services are started only when needed.
|
||||
|
||||
For example, Nginx/Apache are started only after user adds its first domain. MySQL only after adding database/user, phpMyAdmin and WebTerminal only when opened, etc.
|
||||
This allows to minimize resources needed for each user, and allows overselling of resources.
|
||||
|
||||
|
||||
## Memory Usage shows High usage
|
||||
|
||||
Unlike other panels, all usage data is real-time and shows actuall usage for user. As on other panels, physical memory usage is counted in this total usage. This means that if a service or process used ram and exits, that ram is not automatically returned to the free ram and will still show as used, but in reallity its is cahced ram that can be made available at any time oif needed.
|
||||
|
||||
This often confuses users, so we added to periodically safely drop that cached ram after every hour.
|
||||
|
||||
## New Accounts
|
||||
|
||||
## Accounts with data
|
||||
@@ -0,0 +1,42 @@
|
||||
# How to fix: failed to create runc console socket: mkdir /tmp/pty160439680
|
||||
|
||||
When running command:
|
||||
|
||||
```bash
|
||||
opencli user-login stefan
|
||||
```
|
||||
|
||||
If you receive an error:
|
||||
> failed to create runc console socket: mkdir /tmp/pty1604396800: no space left on device: unknown
|
||||
|
||||
It indicates that the disk space is at 100% and you need to first free some space on the server in order to login.
|
||||
|
||||
First, find the partition that is full:
|
||||
|
||||
```bash
|
||||
df -h
|
||||
```
|
||||
|
||||
Example output:
|
||||
```bash
|
||||
df -h
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
tmpfs 3.2G 307M 2.9G 10% /run
|
||||
/dev/vda1 296G 296G 0 100% /
|
||||
tmpfs 16G 252K 16G 1% /dev/shm
|
||||
tmpfs 5.0M 0 5.0M 0% /run/lock
|
||||
/dev/dm-1 10G 5.7G 4.4G 57% /var/lib/docker/devicemapper/mnt/ef7bedfb84a4b7d216944174518a29d79edbc11a17546f0a6f9f691128a0577d
|
||||
/dev/dm-3 10G 1.1G 8.9G 11% /var/lib/docker/devicemapper/mnt/ff5c36635ee829daf9f9aef6b23b02afb7ee34431a2c37c4321b97a1568ba435
|
||||
/dev/dm-5 160G 6.5G 154G 5% /var/lib/docker/devicemapper/mnt/77de40032c66f2f6926209de4e58a0eced5113cdc32bb363127857b1442a2989
|
||||
|
||||
```
|
||||
|
||||
In this example we see that the entire / is full, so we can use a tools such as `ncdu` do check what is using the disk space:
|
||||
|
||||
```bash
|
||||
ncdu /
|
||||
```
|
||||
|
||||
Navigate through directories and delete any old backups or log files by pressing `D` on the keyboard.
|
||||
|
||||
After freeing disk space, repeat the command.
|
||||
@@ -0,0 +1,12 @@
|
||||
# How to fix: failed to create runc console socket: stat /tmp
|
||||
|
||||
When running command:
|
||||
|
||||
```bash
|
||||
opencli user-login stefan
|
||||
```
|
||||
|
||||
If you receive an error:
|
||||
> failed to create runc console socket: stat /tmp: no such file or directory: unknown
|
||||
|
||||
It indicates that docker runtime files from the /tmp are missing (deleted by some program/user), so the quickest solution is to reboot the server.
|
||||
Reference in New Issue
Block a user