User Tools

Site Tools


forgejo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
forgejo [2025/03/28 05:23] ryanforgejo [2025/03/28 08:03] (current) – [Set up Forgerunner:] ryan
Line 5: Line 5:
 ====Set up Forgerunner:==== ====Set up Forgerunner:====
  
-make a new directory and create a compose.yml file with the following: +Copy and paste the following commands (NoteIf using docker, change the podman commands and the socket to their docker equivalent): 
-  services:+ 
 + 
 +  mkdir forgerunner 
 +  cd forgerunner 
 +  mkdir data 
 +  touch compose.yml 
 +  echo "services:
     forgejo-runner:     forgejo-runner:
       hostname: forgerunner       hostname: forgerunner
Line 12: Line 18:
       container_name: forgejorunner       container_name: forgejorunner
       environment:       environment:
-        DOCKER_HOST: unix:///var/run/docker.sock+        DOCKER_HOST: unix:///var/run/podman/podman.sock
       user: 0:0 #Gives permission errors if not root. Can this be fixed somehow?       user: 0:0 #Gives permission errors if not root. Can this be fixed somehow?
       volumes:       volumes:
         - ./data:/data         - ./data:/data
-        - /var/run/docker.sock:/var/run/docker.sock+        - /var/run/podman/podman.sock:/var/run/podman/podman.sock
       restart: unless-stopped       restart: unless-stopped
              
-      command: forgejo-runner -c /data/config.yaml daemon +      command: forgejo-runner -c /data/config.yaml daemon" > compose.yml 
-save it and create a new folder in the same directory called "data"+     
 +  sudo podman-compose run --rm forgejo-runner 'forgejo-runner' 'generate-config' > data/config.yaml 
 +  sudo podman-compose up -d 
 +  sudo podman-compose run --rm forgejo-runner 'forgejo-runner' 'register' 
 +   
 +- STOP and verify that something hasn't gone wrong at this step. Check the new config.yaml that was generated.
  
 +- Follow the prompts. Enter your forgejo url and runner token from YourRepo -> Settings -> Actions -> Runners -> Create new runner
  
-  mkdir forgerunner +- Check the runners list in your repository. It should show up as inactive. 
-  cd forgerunner + 
-  mkdir data +- Navigate to your repo either in browser or locally and create a new file under .forgejo/workflows/ called "deploy.yml" (or name it whatever you prefer) 
-  touch compose.yml + 
-  echo "services+- Inside deploy.yml paste the following: 
-  forgejo-runner+ 
-    hostnameforgerunner +  name: Auto Pull 
-    imagecode.forgejo.org/forgejo/runner:5.0.4 +   
-    container_nameforgejorunner +  on: [push] 
-    environment+  #on
-      DOCKER_HOSTunix:///var/run/docker.sock +  #  push
-    user0:#Gives permission errors if not rootCan this be fixed somehow? +  #    branches
-    volumes+  #      - 'main' 
-      - ./data:/data +   
-      /var/run/docker.sock:/var/run/docker.sock +  jobs
-    restartunless-stopped +    deploy
-     +      runs-ondocker 
-    command: forgejo-runner -c /data/config.yaml daemon" > c.yml +      steps: 
-     +        - name: SSH Deploy 
-+          uses: https://github.com/appleboy/ssh-action@v1 
 +          with: 
 +            host${{ secrets.HOST_ADDRESS }} 
 +            username: forgejo #$ {{ secrets.SSH_USER }} # 
 +            key${{ secrets.SSH_PRIVATE_KEY }} 
 +            script
 +              ls 
 +              cd homeserver 
 +              ${{ secrets.SCRIPT }} 
 +               
 +The variables used are stored in the settings of your repository under YourRepo -> Settings -> Actions -> Secrets  
 +Make sure to create matching secrets or adjust the variables accordingly
 + 
 +- Testing requiredby commenting out the line "on: [push]" and un-commenting the lines beneath it, it should be possible to specify which branch is being checked for updates. 
 + 
 +- Under "script: |" is the command line script that is run once an SSH connection is established. The SCRIPT secret contains the git pull command to update the repository locally. You can enter your credentials with this command by using the following syntax at the command line, replacing the capitalized words to whatever you need: 
 +  git pull https://USER:PASSWORD@forge.melm.xyz/USERNAME/REPONAME 
 +   
 +Make sure your local repository is synced by pulling or pushing the changes. Now the script should automatically run on every push.
forgejo.1743139392.txt.gz · Last modified: by ryan