Skip to content

Commit

Permalink
Merge pull request #26 from ublue-os/check-podman-socket
Browse files Browse the repository at this point in the history
feat(main): improve usage
  • Loading branch information
tepene authored Apr 30, 2024
2 parents 9cc3b51 + e2e3823 commit b0470d1
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 53 deletions.
3 changes: 3 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
enabled: true
titleOnly: true
15 changes: 0 additions & 15 deletions .github/workflows/conventional-commits.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
name: release-please

---
on:
push:
branches:
- main

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
33 changes: 19 additions & 14 deletions .gitmessage
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<type>(optional scope): <description>
<type>(optional scope): <description> (optional #<issue-id>)

[optional body]

[optional footer(s)]

####
# Allowed <type> 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 <type> 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
#
####
2 changes: 1 addition & 1 deletion forge-pod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
67 changes: 52 additions & 15 deletions forge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,19 +27,24 @@ 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}"
}

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}"
Expand Down Expand Up @@ -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}"
Expand All @@ -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}"
Expand Down

0 comments on commit b0470d1

Please sign in to comment.