From d855d03eb9712f98112fa8c22b55cb4688aaa948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 08:49:32 +0000 Subject: [PATCH 1/8] feat(main): check if podman is installed --- forge.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/forge.sh b/forge.sh index e7eddb9..5913ead 100755 --- a/forge.sh +++ b/forge.sh @@ -113,6 +113,18 @@ function check_prerequisites { echo -e "${GREEN}podman is installed${ENDCOLOR}" echo "" fi + echo -e "${YELLOW}Checking podman socket service${ENDCOLOR}" + PODMAN_SERVICE_STATUS="$(systemctl --user is-active podman.socket)" + if [ "${PODMAN_SERVICE_STATUS}" != "active" ]; + then + echo -e "${RED}It looks like your podman socket is not running.${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 + else + echo -e "${GREEN}podman socket is ${PODMAN_SERVICE_STATUS}${ENDCOLOR}" + echo "" + fi echo -e "${YELLOW}Checking jq installation${ENDCOLOR}" JQ_PATH=$(which jq 2>/dev/null || echo 'FALSE') if [ "$JQ_PATH" == "FALSE" ]; From c691ebaeac8fb549801e108679ea3dfc8718443f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 08:50:23 +0000 Subject: [PATCH 2/8] feat: check if user use unprivileged port 80 --- forge.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/forge.sh b/forge.sh index 5913ead..873c3ea 100755 --- a/forge.sh +++ b/forge.sh @@ -125,6 +125,18 @@ function check_prerequisites { echo -e "${GREEN}podman socket is ${PODMAN_SERVICE_STATUS}${ENDCOLOR}" 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 jq installation${ENDCOLOR}" JQ_PATH=$(which jq 2>/dev/null || echo 'FALSE') if [ "$JQ_PATH" == "FALSE" ]; From 4698b47ed39250dd1dd9bedda04d56836f178573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 08:50:44 +0000 Subject: [PATCH 3/8] fix: add hint for missing jq installation --- forge.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/forge.sh b/forge.sh index 873c3ea..20bf7d7 100755 --- a/forge.sh +++ b/forge.sh @@ -143,6 +143,7 @@ function check_prerequisites { then echo -e "${RED}It looks like jq is not installed.${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 else echo -e "${GREEN}jq is installed${ENDCOLOR}" From 8a8b396e8d2a1b15eec22e915e4786ca1e71d4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 08:51:39 +0000 Subject: [PATCH 4/8] refactor: change order of pre-requisites checks --- forge.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/forge.sh b/forge.sh index 20bf7d7..2882de9 100755 --- a/forge.sh +++ b/forge.sh @@ -91,17 +91,6 @@ function create_network { } function check_prerequisites { - echo -e "${YELLOW}Checking sshd service${ENDCOLOR}" - SSH_SERVICE_STATUS="$(systemctl is-active sshd)" - if [ "${SSH_SERVICE_STATUS}" = "inactive" ]; - 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}" - exit 1 - else - echo -e "${GREEN}sshd service is ${SSH_SERVICE_STATUS}${ENDCOLOR}" - echo "" - fi echo -e "${YELLOW}Checking podman installation${ENDCOLOR}" PODMAN_PATH=$(which podman 2>/dev/null || echo 'FALSE') if [ "$PODMAN_PATH" == "FALSE" ]; @@ -149,6 +138,18 @@ function check_prerequisites { echo -e "${GREEN}jq is installed${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 "" + fi } function show_info { From d93122baf13c0f4ea865ec00b27f641d88ccd456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 09:19:31 +0000 Subject: [PATCH 5/8] fix(main): use full podman.sock path not only user id --- forge-pod.yml | 2 +- forge.sh | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/forge-pod.yml b/forge-pod.yml index 9cd2e46..8e45067 100644 --- a/forge-pod.yml +++ b/forge-pod.yml @@ -19,7 +19,7 @@ spec: volumes: - name: podman-socket hostPath: - path: /run/user/${FORGE_HOST_UID}/podman/podman.sock + path: ${FORGE_PODMAN_SOCKET_PATH} type: Socket - name: ublue-os_forge-certs-pvc persistentVolumeClaim: diff --git a/forge.sh b/forge.sh index 2882de9..5842d89 100755 --- a/forge.sh +++ b/forge.sh @@ -2,7 +2,6 @@ # Variables export FORGE_DOMAIN_NAME="ublue.local" export FORGE_NETWORK_NAME="ublue-os_forge" -export FORGE_HOST_UID=$(id -u) export FORGE_POD_CONFIGURATION="forge-pod.yml" export FORGE_POD_NAME_PRE_AMBLE="ublue-os_forge-" export FORGE_POD_NAME_REVERSE_PROXY=${FORGE_POD_NAME_PRE_AMBLE}rvproxy @@ -91,6 +90,18 @@ function create_network { } function check_prerequisites { + echo -e "${YELLOW}Checking jq installation${ENDCOLOR}" + JQ_PATH=$(which jq 2>/dev/null || echo 'FALSE') + if [ "$JQ_PATH" == "FALSE" ]; + then + echo -e "${RED}It looks like jq is not installed.${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 + else + echo -e "${GREEN}jq is installed${ENDCOLOR}" + echo "" + fi echo -e "${YELLOW}Checking podman installation${ENDCOLOR}" PODMAN_PATH=$(which podman 2>/dev/null || echo 'FALSE') if [ "$PODMAN_PATH" == "FALSE" ]; @@ -112,6 +123,7 @@ function check_prerequisites { exit 1 else 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}" @@ -126,18 +138,6 @@ function check_prerequisites { echo -e "${GREEN}net.ipv4.ip_unprivileged_port_start is ${NET_IPV4_UNPRIV_PORT_START}${ENDCOLOR}" echo "" fi - echo -e "${YELLOW}Checking jq installation${ENDCOLOR}" - JQ_PATH=$(which jq 2>/dev/null || echo 'FALSE') - if [ "$JQ_PATH" == "FALSE" ]; - then - echo -e "${RED}It looks like jq is not installed.${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 - else - echo -e "${GREEN}jq is installed${ENDCOLOR}" - echo "" - fi echo -e "${YELLOW}Checking sshd service${ENDCOLOR}" SSH_SERVICE_STATUS="$(systemctl is-active sshd)" if [ "${SSH_SERVICE_STATUS}" != "active" ]; From d677d7b3053a6906ba91422beca5be1d44701ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 18:47:22 +0000 Subject: [PATCH 6/8] chore(ci): streamline ci configuration with bluefin project --- .github/semantic.yml | 3 +++ .github/workflows/conventional-commits.yml | 15 --------------- ...{release-please.yml => generate_changelog.yml} | 14 ++++++-------- 3 files changed, 9 insertions(+), 23 deletions(-) create mode 100644 .github/semantic.yml delete mode 100644 .github/workflows/conventional-commits.yml rename .github/workflows/{release-please.yml => generate_changelog.yml} (50%) diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 0000000..d90d1fe --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,3 @@ +--- +enabled: true +titleOnly: true diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml deleted file mode 100644 index f539196..0000000 --- a/.github/workflows/conventional-commits.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/release-please.yml b/.github/workflows/generate_changelog.yml similarity index 50% rename from .github/workflows/release-please.yml rename to .github/workflows/generate_changelog.yml index 1ce8eeb..54db10d 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/generate_changelog.yml @@ -1,5 +1,4 @@ -name: release-please - +--- on: push: branches: @@ -7,19 +6,18 @@ on: permissions: contents: write + checks: write + actions: read + packages: write pull-requests: write +name: Generate Changelog jobs: release-please: 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: - uses: google-github-actions/release-please-action@v4 + id: release-please with: release-type: simple package-name: release-please-action - prerelease: true - bump-minor-pre-major: true From 842a6a1bdd706173c24f4bfbd36b58dd530b3624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 18:53:23 +0000 Subject: [PATCH 7/8] chore: update gitmessage template --- .gitmessage | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/.gitmessage b/.gitmessage index 40670c3..88fbe0b 100644 --- a/.gitmessage +++ b/.gitmessage @@ -1,19 +1,24 @@ -(optional scope): +(optional scope): (optional #) [optional body] [optional footer(s)] - -#### -# Allowed values -# --------------------- -# feat: –> A new feature -# fix: –> Fixed a bug -# refactor: –> A code change that's not mainly a bug or new feature -# docs: –> Documentation only changes -# style: –> Changes to styling like white space, formatting, semi-colons) -# chore: –> Other changes that don't modify src or test files -# ci: –> Changes made to the CI configuration like Travis, Circle, Actions -# revert: –> Revert a previous commit -# test: –> Add or fix tests #### +# The CHANGELOG.md is built automatically according to the commit +# messages. Commit messages that are not matched will be ignored! +# +# Supported values +# ----------------------- +# feat: --> Features +# fix: --> Bug Fixes +# doc: --> Documentation +# refactor: --> Refactor +# style: --> Styling +# test: --> Testing +# chore: --> Miscellaneous Tasks +# ci --> CI/CD configuration +# revert: --> Revert +# +## Example: feat(parser): add ability to parse arrays +# +#### \ No newline at end of file From e2e382324b6971f6e08c23c63a4611bc8587fe0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Tue, 30 Apr 2024 18:53:53 +0000 Subject: [PATCH 8/8] feat(main): show container info in setup --- forge.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/forge.sh b/forge.sh index 5842d89..c6f8586 100755 --- a/forge.sh +++ b/forge.sh @@ -27,7 +27,8 @@ function setup { echo "" echo -e "${YELLOW}Cleaning up secrets...${ENDCOLOR}" delete_secrets - show_info + echo -e "${GREEN}Setup complete${ENDCOLOR}" + show_forge_info echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}" } @@ -35,11 +36,15 @@ function up { echo -e "${YELLOW}Heating up forge...${ENDCOLOR}" podman pod start ${FORGE_POD_NAME_REVERSE_PROXY} 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}" } function down { 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_REGISTRY}" --ignore echo -e "${GREEN}Done. Have a nice day${ENDCOLOR}" @@ -152,7 +157,13 @@ function check_prerequisites { 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 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}"