Merge pull request #26 from ublue-os/check-podman-socket

feat(main): improve usage
This commit is contained in:
Stephan Lüscher 2024-04-30 21:00:06 +02:00 committed by GitHub
commit b0470d1610
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 81 additions and 53 deletions

3
.github/semantic.yml vendored Normal file
View file

@ -0,0 +1,3 @@
---
enabled: true
titleOnly: true

View file

@ -1,15 +0,0 @@
name: Conventional Commits
on:
pull_request:
branches:
- main
jobs:
build:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: webiny/action-conventional-commits@v1.3.0

View file

@ -1,5 +1,4 @@
name: release-please ---
on: on:
push: push:
branches: branches:
@ -7,19 +6,18 @@ on:
permissions: permissions:
contents: write contents: write
checks: write
actions: read
packages: write
pull-requests: write pull-requests: write
name: Generate Changelog
jobs: jobs:
release-please: release-please:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release-please.outputs.releases_created }}
tag: ${{ steps.release-please.outputs.tag_name }}
upload_url: ${{ steps.release-please.outputs.upload_url }}
steps: steps:
- uses: google-github-actions/release-please-action@v4 - uses: google-github-actions/release-please-action@v4
id: release-please
with: with:
release-type: simple release-type: simple
package-name: release-please-action package-name: release-please-action
prerelease: true
bump-minor-pre-major: true

View file

@ -1,19 +1,24 @@
<type>(optional scope): <description> <type>(optional scope): <description> (optional #<issue-id>)
[optional body] [optional body]
[optional footer(s)] [optional footer(s)]
#### ####
# Allowed <type> values # The CHANGELOG.md is built automatically according to the commit
# --------------------- # messages. Commit messages that are not matched will be ignored!
# feat: > A new feature #
# fix: > Fixed a bug # Supported <type> values
# refactor: > A code change that's not mainly a bug or new feature # -----------------------
# docs: > Documentation only changes # feat: --> Features
# style: > Changes to styling like white space, formatting, semi-colons) # fix: --> Bug Fixes
# chore: > Other changes that don't modify src or test files # doc: --> Documentation
# ci: > Changes made to the CI configuration like Travis, Circle, Actions # refactor: --> Refactor
# revert: > Revert a previous commit # style: --> Styling
# test: > Add or fix tests # test: --> Testing
# chore: --> Miscellaneous Tasks
# ci --> CI/CD configuration
# revert: --> Revert
#
## Example: feat(parser): add ability to parse arrays
#
#### ####

View file

@ -19,7 +19,7 @@ spec:
volumes: volumes:
- name: podman-socket - name: podman-socket
hostPath: hostPath:
path: /run/user/${FORGE_HOST_UID}/podman/podman.sock path: ${FORGE_PODMAN_SOCKET_PATH}
type: Socket type: Socket
- name: ublue-os_forge-certs-pvc - name: ublue-os_forge-certs-pvc
persistentVolumeClaim: persistentVolumeClaim:

View file

@ -2,7 +2,6 @@
# Variables # Variables
export FORGE_DOMAIN_NAME="ublue.local" export FORGE_DOMAIN_NAME="ublue.local"
export FORGE_NETWORK_NAME="ublue-os_forge" export FORGE_NETWORK_NAME="ublue-os_forge"
export FORGE_HOST_UID=$(id -u)
export FORGE_POD_CONFIGURATION="forge-pod.yml" export FORGE_POD_CONFIGURATION="forge-pod.yml"
export FORGE_POD_NAME_PRE_AMBLE="ublue-os_forge-" export FORGE_POD_NAME_PRE_AMBLE="ublue-os_forge-"
export FORGE_POD_NAME_REVERSE_PROXY=${FORGE_POD_NAME_PRE_AMBLE}rvproxy export FORGE_POD_NAME_REVERSE_PROXY=${FORGE_POD_NAME_PRE_AMBLE}rvproxy
@ -28,7 +27,8 @@ function setup {
echo "" echo ""
echo -e "${YELLOW}Cleaning up secrets...${ENDCOLOR}" echo -e "${YELLOW}Cleaning up secrets...${ENDCOLOR}"
delete_secrets delete_secrets
show_info echo -e "${GREEN}Setup complete${ENDCOLOR}"
show_forge_info
echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}" echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}"
} }
@ -36,11 +36,15 @@ function up {
echo -e "${YELLOW}Heating up forge...${ENDCOLOR}" echo -e "${YELLOW}Heating up forge...${ENDCOLOR}"
podman pod start ${FORGE_POD_NAME_REVERSE_PROXY} podman pod start ${FORGE_POD_NAME_REVERSE_PROXY}
podman pod start ${FORGE_POD_NAME_REGISTRY} podman pod start ${FORGE_POD_NAME_REGISTRY}
echo -e "${GREEN}The following containers are now running...${ENDCOLOR}"
show_containter_info
echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}" echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}"
} }
function down { function down {
echo -e "${YELLOW}Cooling down forge...${ENDCOLOR}" echo -e "${YELLOW}Cooling down forge...${ENDCOLOR}"
echo -e "${YELLOW}Shutting down the following containers..${ENDCOLOR}"
show_containter_info
podman pod stop "${FORGE_POD_NAME_REVERSE_PROXY}" --ignore podman pod stop "${FORGE_POD_NAME_REVERSE_PROXY}" --ignore
podman pod stop "${FORGE_POD_NAME_REGISTRY}" --ignore podman pod stop "${FORGE_POD_NAME_REGISTRY}" --ignore
echo -e "${GREEN}Done. Have a nice day${ENDCOLOR}" echo -e "${GREEN}Done. Have a nice day${ENDCOLOR}"
@ -91,15 +95,16 @@ function create_network {
} }
function check_prerequisites { function check_prerequisites {
echo -e "${YELLOW}Checking sshd service${ENDCOLOR}" echo -e "${YELLOW}Checking jq installation${ENDCOLOR}"
SSH_SERVICE_STATUS="$(systemctl is-active sshd)" JQ_PATH=$(which jq 2>/dev/null || echo 'FALSE')
if [ "${SSH_SERVICE_STATUS}" = "inactive" ]; if [ "$JQ_PATH" == "FALSE" ];
then then
echo -e "${RED}It looks like your sshd service is not running.${ENDCOLOR}" echo -e "${RED}It looks like jq is not installed.${ENDCOLOR}"
echo -e "${RED}Make sure to configure and start it first.${ENDCOLOR}" echo -e "${RED}Make sure to install it first.${ENDCOLOR}"
echo -e "${YELLOW}Need help? -> https://jqlang.github.io/jq/download{ENDCOLOR}"
exit 1 exit 1
else else
echo -e "${GREEN}sshd service is ${SSH_SERVICE_STATUS}${ENDCOLOR}" echo -e "${GREEN}jq is installed${ENDCOLOR}"
echo "" echo ""
fi fi
echo -e "${YELLOW}Checking podman installation${ENDCOLOR}" echo -e "${YELLOW}Checking podman installation${ENDCOLOR}"
@ -113,20 +118,52 @@ function check_prerequisites {
echo -e "${GREEN}podman is installed${ENDCOLOR}" echo -e "${GREEN}podman is installed${ENDCOLOR}"
echo "" echo ""
fi fi
echo -e "${YELLOW}Checking jq installation${ENDCOLOR}" echo -e "${YELLOW}Checking podman socket service${ENDCOLOR}"
JQ_PATH=$(which jq 2>/dev/null || echo 'FALSE') PODMAN_SERVICE_STATUS="$(systemctl --user is-active podman.socket)"
if [ "$JQ_PATH" == "FALSE" ]; if [ "${PODMAN_SERVICE_STATUS}" != "active" ];
then then
echo -e "${RED}It looks like jq is not installed.${ENDCOLOR}" echo -e "${RED}It looks like your podman socket is not running.${ENDCOLOR}"
echo -e "${RED}Make sure to install it first.${ENDCOLOR}" echo -e "${RED}Make sure to configure and start it first.${ENDCOLOR}"
echo -e "${YELLOW}Need help? -> https://github.com/containers/podman/blob/main/docs/tutorials/socket_activation.md${ENDCOLOR}"
exit 1 exit 1
else else
echo -e "${GREEN}jq is installed${ENDCOLOR}" echo -e "${GREEN}podman socket is ${PODMAN_SERVICE_STATUS}${ENDCOLOR}"
export FORGE_PODMAN_SOCKET_PATH=$(podman system info -f json | jq '.host.remoteSocket.path')
echo ""
fi
echo -e "${YELLOW}Checking net.ipv4.ip_unprivileged_port_start${ENDCOLOR}"
NET_IPV4_UNPRIV_PORT_START="$(sysctl -n net.ipv4.ip_unprivileged_port_start)"
if [ "${NET_IPV4_UNPRIV_PORT_START}" -gt 80 ];
then
echo -e "${RED}Your net.ipv4.ip_unprivileged_port_start is set to ${NET_IPV4_UNPRIV_PORT_START}${ENDCOLOR}"
echo -e "${RED}Make sure to configure net.ipv4.ip_unprivileged_port_start to <= 80${ENDCOLOR}"
echo -e "${YELLOW}Need help? -> run 'sudo sysctl net.ipv4.ip_unprivileged_port_start=80' for this session or run 'sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80' for a permanent configuration${ENDCOLOR}"
exit 1
else
echo -e "${GREEN}net.ipv4.ip_unprivileged_port_start is ${NET_IPV4_UNPRIV_PORT_START}${ENDCOLOR}"
echo ""
fi
echo -e "${YELLOW}Checking sshd service${ENDCOLOR}"
SSH_SERVICE_STATUS="$(systemctl is-active sshd)"
if [ "${SSH_SERVICE_STATUS}" != "active" ];
then
echo -e "${RED}It looks like your sshd service is not running.${ENDCOLOR}"
echo -e "${RED}Make sure to configure and start it first.${ENDCOLOR}"
echo -e "${YELLOW}Need help? -> https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators-guide/infrastructure-services/OpenSSH/#s2-ssh-configuration-sshd${ENDCOLOR}"
exit 1
else
echo -e "${GREEN}sshd service is ${SSH_SERVICE_STATUS}${ENDCOLOR}"
echo "" echo ""
fi fi
} }
function show_info { function show_containter_info (
podman container ps --filter "name=${FORGE_POD_NAME_PRE_AMBLE}" --format "table {{.Names}} {{.Status}} {{.Image}}"
)
function show_forge_info {
echo -e "${GREEN}The following containers are now running...${ENDCOLOR}"
show_containter_info
echo -e "${GREEN}uBlue forge reverse-proxy is available at: https://traefik.${FORGE_DOMAIN_NAME}${ENDCOLOR}" echo -e "${GREEN}uBlue forge reverse-proxy is available at: https://traefik.${FORGE_DOMAIN_NAME}${ENDCOLOR}"
echo -e "${GREEN}uBlue forge docker registry is available at: registry.${FORGE_DOMAIN_NAME}${ENDCOLOR}" echo -e "${GREEN}uBlue forge docker registry is available at: registry.${FORGE_DOMAIN_NAME}${ENDCOLOR}"
echo -e "${GREEN}To trust the certificate in your Browser of choice, make sure to import the root certificate from:${ENDCOLOR}" echo -e "${GREEN}To trust the certificate in your Browser of choice, make sure to import the root certificate from:${ENDCOLOR}"