Use host
172.17.0.1
And of course, make sure your local service allowed remote connection.
Use host
172.17.0.1
And of course, make sure your local service allowed remote connection.
frontend ssl
bind :443
mode tcp
option tcplog
# Wait for a client hello for at most 5 seconds
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend be_ssl_hosting if { req_ssl_sni -i jooservices.com }
default_backend be_ssl
backend be_ssl_hosting
mode tcp
balance roundrobin
server aaa_ssl_server 192.168.1.39:443 check
Create user have permissions on all tables
GRANT ALL PRIVILEGES ON *.* TO 'user1'@localhost IDENTIFIED BY 'password1';
Create user have permissions on specific table
GRANT ALL PRIVILEGES ON 'yourDB'.* TO 'user1'@localhost;
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'user1'@localhost;
Drop user
DROP USER 'user1'@localhost;
Create user for exporter
CREATE USER 'exporter'@'192.168.1.%' IDENTIFIED BY 'password' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
https://phoenixnap.com/kb/how-to-create-mariadb-user-grant-privileges
Redis
In your
retry_afterconfig/queue.php
configuration file, each queue connection defines aretry_after
option. This option specifies how many seconds the queue connection should wait before retrying a job that is being processed. For example, if the value ofretry_after
is set to90
, the job will be released back onto the queue if it has been processing for 90 seconds without being released or deleted. Typically, you should set theretry_after
value to the maximum number of seconds your jobs should reasonably take to complete processing.
Về cơ bản infrastructure network này mình build chưa được hoàn thiện, nhưng cũng thấy tương đối happy về nó. 1 chút chia sẽ.
Router 3910
Core Switch – CnMatrix 2028-P
ProDesk
gatekeeper
Asrock X300
Workstation
I’m using HAProxy for mostly all of my services
Context của bài toán này là build 1 con Docker để chạy Github Runners ( scaleble ). Và mọi thứ được chạy trong 1 con VM thuộc về ESXi
sudo
cũng được )Và ta có 1 file docker-compose sau
version: "3.7"
services:
runner:
image: myoung34/github-runner:latest
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
RUNNER_SCOPE: repo
RUNNER_NAME_PREFIX: runner
LABELS: ubuntu,x64
REPO_URL: <repository_url>
EPHEMERAL: 1
ACCESS_TOKEN: <github_token>
deploy:
replicas: 4
resources:
limits: // Giới hạn tối đa
cpus: '1'
memory: 2G
reservations: // Tối thiểu
cpus: '1'
memory: 1G
Và giờ chỉ cần chạy docker-compose up -d
Tuy nhiên câu chuyện chưa hết vui !!! Do bản chất ta đang chạy qua Docker. Do đó việc build các service ( cũng qua docker ) lại không khả thi. Cụ thể là ta cần build MySQL / Redis etc … Vậy thì sao ???
…. tách em nó ra 1 VM khác và update lại IP về con VM đó thôi 😀 . Chút mất công nhưng cơ bản đã dễ dàng rất nhiều.
Từ giờ con VM chạy Runners ta tạo n folder, mỗi folder cho 1 docker-compose
ứng với 1 repository
soulevil ALL=(ALL) NOPASSWD:ALL
How to check if port is in use in
sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo ss -tulpn | grep LISTEN
sudo lsof -i:22 ## see a specific port such as 22 ##
sudo nmap -sTU -O IP-address-Here
Template Method là một design pattern trong đó một khuôn mẫu được định nghĩa, chứa một số bước cơ bản của một thuật toán, trong khi các bước cụ thể được định nghĩa bởi các lớp con. Khuôn mẫu này đảm bảo rằng các bước cơ bản của thuật toán được thực hiện theo cùng một cách, nhưng cách thức cụ thể của từng bước có thể được thay đổi bởi các lớp con.
abstract class Report {
public function generate() {
$this->setData();
$this->formatData();
$this->generateOutput();
}
abstract protected function setData();
protected function formatData() {
// default implementation
}
abstract protected function generateOutput();
}
class PdfReport extends Report {
protected function setData() {
// set data for pdf report
}
protected function generateOutput() {
// generate pdf output
}
}
class ExcelReport extends Report {
protected function setData() {
// set data for excel report
}
protected function generateOutput() {
// generate excel output
}
}
Trong đoạn code này, Report
là một abstract class định nghĩa khuôn mẫu cho việc tạo ra báo cáo. Phương thức generate()
định nghĩa các bước cơ bản trong việc tạo ra báo cáo, bao gồm setData()
, formatData()
và generateOutput()
. Trong đó, setData()
và generateOutput()
là các phương thức trừu tượng và phải được định nghĩa bởi các lớp con. Trong khi đó, formatData()
có một implementation mặc định, nhưng có thể được ghi đè bởi các lớp con nếu cần thiết.
Các lớp con, như PdfReport
và ExcelReport
, kế thừa từ Report
và định nghĩa các phương thức trừu tượng để thực hiện các bước cụ thể trong việc tạo ra báo cáo. Ví dụ, PdfReport
định nghĩa setData()
để thiết lập dữ liệu cho báo cáo PDF, và generateOutput()
để tạo ra đầu ra PDF. Tương tự, ExcelReport
định nghĩa setData()
và generateOutput()
để tạo ra báo cáo Excel.
Khi chúng ta muốn tạo ra một báo cáo, chúng ta có thể tạo một đối tượng của lớp con và gọi phương thức generate()
. Phương thức này sẽ thực hiện các bước cơ bản của thuật toán và gọi các phương thức cụ thể của lớp con để thực hiện các bước cụ