feat: Update CI/CD scripts and configurations for improved deployment and system management
Some checks failed
GBCI / build (push) Failing after 5m14s
Some checks failed
GBCI / build (push) Failing after 5m14s
This commit is contained in:
parent
c75095505b
commit
408c1c8158
5 changed files with 44 additions and 39 deletions
|
@ -23,12 +23,12 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
- name: Run build
|
- name: Run build
|
||||||
run: cargo build --workspace --release --locked
|
run: cargo build --locked
|
||||||
|
|
||||||
- name: Deploy binary
|
- name: Deploy binary
|
||||||
run: |
|
run: |
|
||||||
sudo cp ./target/release/gbserver /opt/gbo/bin/system
|
sudo cp ./target/release/gbserver /opt/gbo/bin/system
|
||||||
sudo chmod +x /opt/gbo/bin/system/gbserver
|
sudo chmod +x /opt/gbo/bin/system/gbserver
|
||||||
|
|
||||||
sudo systemctl restart gbserver
|
lxc exec bot:pragmatismo-system -- systemctl restart system
|
||||||
|
|
6
src/scripts/setup-host.sh
Normal file
6
src/scripts/setup-host.sh
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
# Host
|
||||||
|
sudo lxc config set core.trust_password "$LXC_TRUST_PASSWORD"
|
||||||
|
|
||||||
|
# ALM-CI
|
||||||
|
lxc remote add bot 10.16.164.? --accept-certificate --password "$LXC_TRUST_PASSWORD"
|
|
@ -8,4 +8,3 @@ chmod +x /etc/profile.d/notimeout.sh
|
||||||
sed -i '/pam_exec.so/s/quiet/quiet set_timeout=0/' /etc/pam.d/sshd 2>/dev/null
|
sed -i '/pam_exec.so/s/quiet/quiet set_timeout=0/' /etc/pam.d/sshd 2>/dev/null
|
||||||
source /etc/profile
|
source /etc/profile
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ rustc --version
|
||||||
|
|
||||||
|
|
||||||
# Install Xvfb and other dependencies
|
# Install Xvfb and other dependencies
|
||||||
sudo apt install -y xvfb libgbm-dev
|
sudo apt install -y xvfb libgbm-dev lxd-client
|
||||||
|
|
||||||
# Create directories
|
# Create directories
|
||||||
mkdir -p \"$BIN_PATH\" /opt/gbo/data /opt/gbo/conf /opt/gbo/logs || { echo 'Directory creation failed'; exit 1; }
|
mkdir -p \"$BIN_PATH\" /opt/gbo/data /opt/gbo/conf /opt/gbo/logs || { echo 'Directory creation failed'; exit 1; }
|
||||||
|
|
|
@ -1,57 +1,57 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
STORAGE_PATH="/opt/gbo/tenants/$PARAM_TENANT/system/data"
|
HOST_BASE="/opt/gbo/tenants/$PARAM_TENANT/system"
|
||||||
LOGS_PATH="/opt/gbo/tenants/$PARAM_TENANT/system/logs"
|
HOST_DATA="$HOST_BASE/data"
|
||||||
|
HOST_CONF="$HOST_BASE/conf"
|
||||||
|
HOST_LOGS="$HOST_BASE/logs"
|
||||||
|
HOST_BIN="$HOST_BASE/bin"
|
||||||
|
BIN_PATH="/opt/gbo/bin"
|
||||||
|
CONTAINER_NAME="${PARAM_TENANT}-system"
|
||||||
|
|
||||||
mkdir -p "${STORAGE_PATH}" "${LOGS_PATH}"
|
# Create host directories
|
||||||
chmod -R 770 "${STORAGE_PATH}" "${LOGS_PATH}"
|
mkdir -p "$HOST_DATA" "$HOST_CONF" "$HOST_LOGS" || exit 1
|
||||||
chown -R 100999:100999 "${STORAGE_PATH}" "${LOGS_PATH}"
|
chmod -R 750 "$HOST_BASE" || exit 1
|
||||||
|
|
||||||
lxc launch images:debian/12 "${PARAM_TENANT}-system" -c security.privileged=true
|
|
||||||
|
lxc launch images:debian/12 $CONTAINER_NAME -c security.privileged=true
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
lxc config device add "${PARAM_TENANT}-system" storage disk source="${STORAGE_PATH}" path=/data
|
lxc exec $CONTAINER_NAME -- bash -c '
|
||||||
lxc config device add "${PARAM_TENANT}-system" logs disk source="${LOGS_PATH}" path=/var/log/minio
|
|
||||||
|
|
||||||
lxc exec "${PARAM_TENANT}-system" -- bash -c '
|
|
||||||
|
|
||||||
apt-get update && apt-get install -y wget
|
apt-get update && apt-get install -y wget
|
||||||
wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio
|
|
||||||
chmod +x /usr/local/bin/minio
|
|
||||||
|
|
||||||
useradd -r -s /bin/false minio-user || true
|
useradd -r -s /bin/false gbuser || true
|
||||||
mkdir -p /var/log/minio /data
|
mkdir -p /opt/gbo/logs /opt/gbo/bin /opt/gbo/data /opt/gbo/conf
|
||||||
chown -R minio-user:minio-user /var/log/minio /data
|
chown -R gbuser:gbuser /opt/gbo/
|
||||||
|
|
||||||
cat > /etc/systemd/system/minio.service <<EOF
|
cat > /etc/systemd/system/system.service <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=MinIO
|
Description=General Bots System Service
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=minio-user
|
User=gbuser
|
||||||
Group=minio-user
|
Group=gbuser
|
||||||
Environment="MINIO_ROOT_USER='"${PARAM_system_USER}"'"
|
ExecStart=/opt/gbo/bin/gbserver
|
||||||
Environment="MINIO_ROOT_PASSWORD='"${PARAM_system_PASSWORD}"'"
|
StandardOutput=append:/opt/gbo/logs/output.log
|
||||||
ExecStart=/usr/local/bin/minio server --console-address ":'"${PARAM_system_PORT}"'" /data
|
StandardError=append:/opt/gbo/logs/error.log
|
||||||
StandardOutput=append:/var/log/minio/output.log
|
|
||||||
StandardError=append:/var/log/minio/error.log
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable minio
|
systemctl enable system
|
||||||
systemctl start minio
|
systemctl start system
|
||||||
'
|
'
|
||||||
|
|
||||||
lxc config device remove "${PARAM_TENANT}-system" minio-proxy 2>/dev/null || true
|
lxc config device add $CONTAINER_NAME bin disk source="${HOST_BIN}" path=/opt/gbo/bin
|
||||||
lxc config device add "${PARAM_TENANT}-system" minio-proxy proxy \
|
lxc config device add $CONTAINER_NAME data disk source="${HOST_DATA}" path=/opt/gbo/data
|
||||||
listen=tcp:0.0.0.0:"${PARAM_system_API_PORT}" \
|
lxc config device add $CONTAINER_NAME conf disk source="${HOST_CONF}" path=/opt/gbo/conf
|
||||||
connect=tcp:127.0.0.1:"${PARAM_system_API_PORT}"
|
lxc config device add $CONTAINER_NAME logs disk source="${HOST_LOGS}" path=/opt/gbo/logs
|
||||||
|
|
||||||
lxc config device remove "${PARAM_TENANT}-system" console-proxy 2>/dev/null || true
|
|
||||||
lxc config device add "${PARAM_TENANT}-system" console-proxy proxy \
|
lxc config device remove $CONTAINER_NAME proxy 2>/dev/null || true
|
||||||
listen=tcp:0.0.0.0:"${PARAM_system_PORT}" \
|
lxc config device add $CONTAINER_NAME proxy proxy \
|
||||||
connect=tcp:127.0.0.1:"${PARAM_system_PORT}"
|
listen=tcp:0.0.0.0:"${PARAM_SYSTEM_PORT}" \
|
||||||
|
connect=tcp:127.0.0.1:"${PARAM_SYSTEM_PORT}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue