viernes, 7 de febrero de 2025

allow mysql remote connection and installing phpmyadmin

 


1  allow remote connections



nano /etc/my.cnf.d/mariadb-server.cnf



[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mariadb/mariadb.log

pid-file=/run/mariadb/mariadb.pid

bind-address = 0.0.0.0



2 restart the service


sudo systemctl restart mariadb


3 check status


sudo systemctl status mariadb


4 Grant   access to the user remotely 


MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'asterisk' WITH GRANT OPTION;

5 Reload  settings

MariaDB [(none)]> FLUSH PRIVILEGES;


6 Test connection


 mysql  -h 135.178.45.132 -u root -pasterisk

7 run phpmyadmin

docker run --name phpmyadmin -d -e PMA_ARBITRARY=1 -p 8080:80 --restart always phpmyadmin/phpmyadmin

jueves, 23 de enero de 2025

Comparison of Methods to Clone or Export a Docker Container

 

Comparison of Methods to Clone or Export a Docker Container

MethodWhat It DoesCapturesIncludes Docker Metadata (e.g., Environment Variables, Exposed Ports, etc.)OutputWhen to Use
1. docker commit + docker saveCommits a running container to an image, then saves the image to a tarball.Full Docker image (file system + metadata)Yes, includes metadata like environment variables, exposed ports, etc.Tarball of Docker image with all layers and metadataWhen you need to clone the container with its full environment, settings, and layers to another server.
2. docker exportExports the file system of a container to a tarball (without Docker metadata).Container's file system only (no image layers or metadata)No, metadata is lost (ports, environment variables, etc.)Tarball of just the container’s file system (without Docker metadata)When you need to copy just the data or file system of a container and don’t need configuration or metadata.
3. docker save (for an image)Saves a Docker image (not a running container) to a tarball, including all its layers and history.Full Docker image (layers and configuration)Yes, includes metadata such as environment variables, labels, etc.Tarball of the Docker image, including layers, history, and metadataWhen you want to save and transfer a Docker image, not a running container, and keep the full image history and layers.
4. docker import (after export)Imports a tarball (typically from docker export) to create a new Docker image, without Docker metadata.Only the file system (no history or layers)No, metadata is lost (you need to reconfigure manually).A new Docker image with just the file system contentWhen you’ve exported a container’s file system and need to create a new image from it.
5. docker cp (copying container data)Copies files/folders from the container’s file system to your local machine or vice versa.Only the copied files/folders, not the entire containerNo, only copies specific files or directories you specifyLocal file system copy (just files or directories, not a Docker image)When you need to copy specific files or data from a container (like a database, config file, or log file).
6. docker-compose (multi-container setup)Uses a docker-compose.yml file to define multi-container environments (volumes, networks, etc.) and deploy them.Full multi-container environment (with networks, volumes, etc.)Yes, includes environment variables, networks, volumes, container links, etc.Re-created multi-container environment (defined in docker-compose.yml)When you need to clone or replicate a multi-container setup (e.g., microservices, apps with databases).
7. Using Third-Party Tools (e.g., docker-clone)Some third-party tools like docker-clone can automate container cloning.Full or partial container environment (depending on the tool)Varies by tool (some tools preserve environment variables, ports, etc.)Container clone (depending on the tool, this might include data, image, or configuration)When you need an automated or simplified way to clone containers, often for repeatable tasks.

Method Breakdown:

1. docker commit + docker save

  • Use Case: Best when you need to move a running container with its full environment to another server, preserving the entire configuration (ports, environment variables, volumes, etc.).
  • Pros:
    • Retains all configuration settings and image history.
    • Preserves environment variables, port mappings, and any customizations made in the container.
    • Transferable to another server or machine.
  • Cons:
    • Requires Docker registry or docker save + docker load process.
    • Larger file size compared to docker export (due to the entire image layers).

2. docker export

  • Use Case: Use this method if you need to copy only the data or file system from the container without any Docker-specific settings or history.
  • Pros:
    • Simple and quick when you just need the container's file system.
    • Ideal for exporting and transferring data (e.g., logs, application data, config files).
  • Cons:
    • No metadata or Docker-specific configurations (environment variables, exposed ports, etc.) are saved.
    • Cannot replicate the exact environment of the original container (you would have to manually configure those settings).

3. docker save (for an image)

  • Use Case: When you want to export a Docker image that you've previously built or pulled, and you want to preserve the image's layers and history.
  • Pros:
    • Captures the entire Docker image (including its layers and configuration).
    • Can be transferred and loaded on another system.
  • Cons:
    • Only works for images (not running containers directly).
    • Will not capture the running state of a container or its data if it's been modified after the image was created.

4. docker import (after export)

  • Use Case: When you've exported a container's file system using docker export and need to recreate it as a Docker image.
  • Pros:
    • Allows you to turn exported file system data back into a Docker image.
    • Simple process for creating an image from just the file system.
  • Cons:
    • Loses all the Docker-specific metadata (environment variables, ports, etc.).
    • Requires manual reconfiguration of the container.

5. docker cp

  • Use Case: When you only need to copy specific files or directories from a running container, without needing the whole container or its image.
  • Pros:
    • Flexible, allows for copying only the needed files.
    • Ideal for extracting application data, logs, or configurations from a running container.
  • Cons:
    • Does not clone the whole container or its environment.
    • Not useful for full environment migration.

6. docker-compose

  • Use Case: When you're dealing with multi-container setups or need to replicate a more complex Docker environment, including networks, volumes, and linked containers.
  • Pros:
    • Simplifies replication of multi-container applications (ideal for microservices).
    • Preserves full environment configuration (networks, volume mounts, etc.).
  • Cons:
    • Requires having a properly configured docker-compose.yml file.
    • Cannot be used to clone just a single container without a Compose setup.

7. Using Third-Party Tools (e.g., docker-clone)

  • Use Case: When you want a simplified and automated solution to clone containers, particularly in development or testing environments.
  • Pros:
    • Can automate container cloning, simplifying repetitive tasks.
    • Some tools may clone both data and metadata automatically.
  • Cons:
    • Depends on the tool; may not support all use cases or configurations.
    • External tools introduce dependencies and may require additional setup.

miércoles, 22 de enero de 2025

fop2 ssl

nano /usr/local/fop2/fop2.cfg

nano usr/src/fop2/server/fop2.cfg


 ssl_certificate_file=/etc/asterisk/keys/pbx.expitrans.net/fullchain.pem

ssl_certificate_key_file=/etc/asterisk/keys/pbx.expitrans.net/private.pem



service fop2 restart

jueves, 14 de noviembre de 2024

Some SSL config

 FreePBX  Centos

/etc/httpd/conf.d/ssl.conf

</VirtualHost>


<VirtualHost *:443>

    ServerName devpbx.expitest.com

    DocumentRoot /var/www/html


    SSLEngine on

    SSLCertificateFile /etc/asterisk/keys/devpbx.expitest.com/fullchain.pem

    SSLCertificateKeyFile /etc/asterisk/keys/devpbx.expitest.com/private.pem


    # Optional for security improvements

    SSLCipherSuite HIGH:!aNULL:!MD5

    SSLProtocol all -SSLv2 -SSLv3

    SSLHonorCipherOrder on


    # Additional settings if needed (e.g., log files, directory options)

</VirtualHost>


[general]

enabled=yes

enablestatic=no


bindaddr=0.0.0.0

bindport=8088


sessionlimit=10000

session_inactivity=30000

session_keep_alive=15000

tlsenable=yes


tlsbindaddr=0.0.0.0:8089


tlscertfile=/etc/asterisk/keys/devpbx.expitest.com/fullchain.pem

tlsprivatekey=/etc/asterisk/keys/devpbx.expitest.com/private.pem





lunes, 11 de noviembre de 2024

Creating an snpashot of docker container

1 Create and modify the container:

 docker run -it ubuntu /bin/bash

# Make changes (e.g., install curl)

apt update && apt install curl -y

exit


2 Commit the container to an image:
docker commit <container_id> my_custom_ubuntu:v1

3 Save the image to a tarball:
docker save -o my_custom_ubuntu.tar my_custom_ubuntu:v1

4 Transfer the tarball to the new server:

scp my_custom_ubuntu.tar user@new_server:/path/to/destination/


5 Load the image on the new server:

docker load -i /path/to/destination/my_custom_ubuntu.tar

6  Start a new container from the image:
docker run -it my_custom_ubuntu:v1 /bin/bash

domingo, 10 de noviembre de 2024

miércoles, 6 de noviembre de 2024

git book

 https://git-scm.com/book/en/v2


https://www.atlassian.com/git