Skip to content

Commit

Permalink
ref: make port setup config (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: ook37 <[email protected]>
  • Loading branch information
oklopfer and ook37 authored Jan 9, 2025
1 parent 6a11bfe commit efde024
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nushell-bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pacstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})"
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions scripts/creator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# You should have received a copy of the GNU General Public License
# along with Pacstall. If not, see <https://www.gnu.org/licenses/>.

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)
Expand All @@ -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
2 changes: 1 addition & 1 deletion server/systemd/aptly-api.service
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit efde024

Please sign in to comment.