diff --git a/.github/workflows/nushell-bin.yml b/.github/workflows/nushell-bin.yml index 7a1ab52..b4f5f58 100644 --- a/.github/workflows/nushell-bin.yml +++ b/.github/workflows/nushell-bin.yml @@ -43,7 +43,7 @@ jobs: run: | LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}" LOCAL_PORT=8080 - REMOTE_PORT=8088 + REMOTE_PORT=${{ secrets.APTLY_PORT }} REPO_URL="http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/packages" ssh -i ~/.ssh/id_ed25519 -fN -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} "${LOCATION}" rm_str="$(./scripts/checker.sh overflow nushell-bin ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})" diff --git a/.github/workflows/pacstall.yml b/.github/workflows/pacstall.yml index 5c468be..69b7fba 100644 --- a/.github/workflows/pacstall.yml +++ b/.github/workflows/pacstall.yml @@ -41,7 +41,7 @@ jobs: run: | LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}" LOCAL_PORT=8080 - REMOTE_PORT=8088 + REMOTE_PORT=${{ secrets.APTLY_PORT }} REPO_URL="http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/packages" ssh -i ~/.ssh/id_ed25519 -fN -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} "${LOCATION}" rm_str="$(./scripts/checker.sh overflow pacstall ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})" diff --git a/README.md b/README.md index ac72ab3..0345e10 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,14 @@ chmod o+x ~/.aptly cp server/ppr-public-key.asc ~/.aptly/public # enable and start aptly api +APTLY_PORT=1234 # can be anything besides 8080, that's for CI to use +sed -i "s/\${APTLY_PORT}/${APTLY_PORT}/g" server/systemd/aptly-api.service sudo cp server/systemd/aptly-api.service /etc/systemd/system/ sudo systemctl enable --now aptly-api +# set up aptly repos +./scripts/creator.sh "${APTLY_PORT}" + # enable and start apache forwarding sudo cp server/apache2/aptly.conf /etc/apache2/sites-available/aptly.conf sudo a2ensite aptly.conf @@ -31,11 +36,9 @@ sudo systemctl enable apache2 --now sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo certbot --apache -d ppr.pacstall.dev - -# set up aptly repos -./scripts/creator.sh ``` Then, set the following repository secrets for GitHub Actions: +- Set the chosen `APTLY_PORT` from above - Generate an ssh keygen pair and set `SSH_USER`, `SSH_IP`, and `SSH_KEY`: - `SSH_USER` - the host user - `SSH_IP` - the IP of the server diff --git a/manager.py b/manager.py index 12d09c5..6cb7e3e 100755 --- a/manager.py +++ b/manager.py @@ -129,7 +129,7 @@ class LiteralString(str): pass "run": LiteralString( f"LOCATION=\"${{{{ secrets.SSH_USER }}}}@${{{{ secrets.SSH_IP }}}}\"\n" f"LOCAL_PORT=8080\n" - f"REMOTE_PORT=8088\n" + f"REMOTE_PORT=${{{{ secrets.APTLY_PORT }}}}\n" f"REPO_URL=\"http://localhost:${{LOCAL_PORT}}/api/repos/ppr-${{{{ matrix.distro }}}}/packages\"\n" f"ssh -i ~/.ssh/id_ed25519 -fN -L ${{LOCAL_PORT}}:localhost:${{REMOTE_PORT}} \"${{LOCATION}}\"\n" f"rm_str=\"$(./scripts/checker.sh overflow {package_name} ${{{{ matrix.distro }}}} ${{{{ matrix.architecture }}}} {overflow} ${{REPO_URL}})\"\n" diff --git a/scripts/creator.sh b/scripts/creator.sh index 10168a1..7e68556 100755 --- a/scripts/creator.sh +++ b/scripts/creator.sh @@ -21,7 +21,7 @@ # You should have received a copy of the GNU General Public License # along with Pacstall. If not, see . -LOCAL_PORT=8088 +APTLY_PORT="${1:?need PORT}" distrolist=("main" "ubuntu-latest" "ubuntu-develop" "ubuntu-rolling" "debian-stable" "debian-testing" "debian-unstable") archlist=("amd64" "arm64" "source") mapfile -t pprlist < <(for i in "${distrolist[@]}"; do echo "{\"Component\": \"${i}\", \"Name\": \"ppr-${i}\"},"; done) @@ -32,10 +32,10 @@ archstring="$(printf '"%s", ' "${archlist[@]}")" for i in "${distrolist[@]}"; do curl -X POST -H 'Content-Type: application/json' \ --data "{\"Name\": \"ppr-${i}\", \"DefaultDistribution\": \"pacstall\", \"DefaultComponent\": \"${i}\"}" \ - http://localhost:"${LOCAL_PORT}"/api/repos + http://localhost:"${APTLY_PORT}"/api/repos done # publish curl -X POST -H 'Content-Type: application/json' \ --data "{\"SourceKind\": \"local\", \"Sources\": [${pprstring%,}], \"Architectures\": [${archstring%, }], \"Distribution\": \"pacstall\", \"Signing\": {\"Skip\": true}, \"MultiDist\": true}" \ - http://localhost:"${LOCAL_PORT}"/api/publish/pacstall + http://localhost:"${APTLY_PORT}"/api/publish/pacstall diff --git a/server/systemd/aptly-api.service b/server/systemd/aptly-api.service index b19cd9c..83cd72f 100644 --- a/server/systemd/aptly-api.service +++ b/server/systemd/aptly-api.service @@ -3,7 +3,7 @@ Description=Aptly API Service After=network.target [Service] -ExecStart=/usr/bin/aptly api serve -listen=:8088 +ExecStart=/usr/bin/aptly api serve -listen=:${APTLY_PORT} WorkingDirectory=/home/${USER}/.aptly User=${USER} Restart=on-failure