commit 593e896e3e3bd3b09bbd53887fc884e2a743ba73 Author: samuel Date: Sat Feb 21 22:52:41 2026 +0100 feat: first commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..de2f316 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +.gitignore export-ignore +.gitattributes export-ignore diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml new file mode 100644 index 0000000..dc4c85a --- /dev/null +++ b/.gitea/workflows/cd.yaml @@ -0,0 +1,26 @@ +name: Continuous Delivery + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + build_n_upload: + runs-on: linux + steps: + - name: Git checkout + uses: actions/checkout@v6 + with: + fetch-tags: true + - name: Build tarball + run: make tarball + env: + GIT_REFERENCE: ${{ github.ref }} + - name: Build rpm package + run: rpmbuild -ba "$(make name).spec" + - name: Upload rpm package + run: make upload + env: + GIT_PACKAGES_USERNAME: ${{ vars.GIT_PACKAGES_USERNAME }} + GIT_PACKAGES_TOKEN: ${{ secrets.GIT_PACKAGES_TOKEN }} diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..e0f9c44 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,20 @@ +name: Continuous Integration + +on: + push: + branches: + - main + +jobs: + lint_n_build: + runs-on: linux + steps: + - name: Git checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + fetch-tags: true + - name: Build tarball + run: make tarball + - name: Build rpm file + run: rpmbuild -ba netoik-rp.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b1128d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.swp +*.env +/.idea diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9a46914 --- /dev/null +++ b/LICENSE @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) 2025 samuel + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0f950ed --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +NAME = netoik-db +VERSION = $(shell git describe --abbrev=0) +RELEASE = $(shell git rev-parse --short HEAD) +REFERENCE = $(if $(GIT_REFERENCE),$(GIT_REFERENCE),$(shell git branch --show-current)) +BUILD_ARCH = noarch + +RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}') +RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}') +RPM_SOURCEDIR = $(shell rpm --eval '%{_sourcedir}') +RPM_SYSCONFDIR = $(shell rpm --eval '%{_sysconfdir}') +RPM_UNITDIR = $(shell rpm --eval '%{_unitdir}') +RPM_TARBALL_PATH = $(RPM_SOURCEDIR)/$(NAME)-$(VERSION).tar.gz +RPM_BUILD_PATH = $(RPM_RPMDIR)/$(BUILD_ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(BUILD_ARCH).rpm + +.PHONY: name +name: + @echo "$(NAME)" + +.PHONY: version +version: + @echo "$(VERSION)" + +.PHONY: release +release: + @echo "$(RELEASE)" + +.PHONY: build_arch +build_arch: + @echo "$(BUILD_ARCH)" + +.PHONY: install +install: + install --directory $(DESTDIR)$(RPM_SYSCONFDIR)/postgres + install --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/postgres files/postgres/postgresql.conf files/nginx/default.conf + +$(RPM_TARBALL_PATH): * + git archive --format=tar.gz \ + --output="$@" \ + --prefix="$(NAME)-$(VERSION)/" \ + --verbose \ + "$(REFERENCE)" + +.PHONY: tarball +tarball: $(RPM_TARBALL_PATH) + +.PHONY: upload +upload: + curl --fail-with-body --upload-file "$(RPM_BUILD_PATH)" --user "$(GIT_PACKAGES_USERNAME):$(GIT_PACKAGES_TOKEN)" https://git.netoik.io/api/packages/$(GIT_PACKAGES_USERNAME)/rpm/upload + diff --git a/README.md b/README.md new file mode 100644 index 0000000..034f5c3 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Netoïk Database ![badge](https://git.netoik.io/samuel/netoik-db/actions/workflows/ci.yaml/badge.svg) + +Build an RPM package which will install the DBMS called Postgresql with custom configuration. diff --git a/files/posgtres/pg_hba.conf b/files/posgtres/pg_hba.conf new file mode 100644 index 0000000..589f81a --- /dev/null +++ b/files/posgtres/pg_hba.conf @@ -0,0 +1,6 @@ +# Before editing this file, please refer to official doc: +# https://www.postgresql.org/docs/current/auth-pg-hba-conf.html + +# TYPE DATABASE USER ADDRESS METHOD +local sameuser all peer # Allow each unix user accessing its own db +local all postgres peer # Allow postgres user accessing all dbs diff --git a/files/posgtres/postgresql.conf b/files/posgtres/postgresql.conf new file mode 100644 index 0000000..3bc89f1 --- /dev/null +++ b/files/posgtres/postgresql.conf @@ -0,0 +1,19 @@ +#------------------------------------------------------------------------------- +# FILE LOCATIONS +# Please refer to official doc before editing this section: +# https://www.postgresql.org/docs/current/runtime-config-file-locations.html +#------------------------------------------------------------------------------- + +# Change pg_hba location +hba_file = "/etc/postgres/pg_hba.conf" + + +#------------------------------------------------------------------------------- +# CONNECTIONS AND AUTHENTICATION +# Please refer to official doc before editing this section: +# https://www.postgresql.org/docs/current/runtime-config-connection.html +#------------------------------------------------------------------------------- + +# Empty listen addresses to disable listening via TCP/IP +# because we want only uni socket connections +listen_addresses = ""