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 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 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 e7eddb9..c6f8586 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 @@ -28,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}" } @@ -36,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}" @@ -91,15 +95,16 @@ 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" ]; + 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 your sshd service is not running.${ENDCOLOR}" - echo -e "${RED}Make sure to configure and start it first.${ENDCOLOR}" + 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}sshd service is ${SSH_SERVICE_STATUS}${ENDCOLOR}" + echo -e "${GREEN}jq is installed${ENDCOLOR}" echo "" fi echo -e "${YELLOW}Checking podman installation${ENDCOLOR}" @@ -113,20 +118,52 @@ function check_prerequisites { echo -e "${GREEN}podman is installed${ENDCOLOR}" echo "" fi - echo -e "${YELLOW}Checking jq installation${ENDCOLOR}" - JQ_PATH=$(which jq 2>/dev/null || echo 'FALSE') - if [ "$JQ_PATH" == "FALSE" ]; + 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 jq is not installed.${ENDCOLOR}" - echo -e "${RED}Make sure to install it first.${ENDCOLOR}" + 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}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 "" 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}"