cooperspencer / gickup

https://cooperspencer.github.io/gickup-documentation/
Apache License 2.0
955 stars 33 forks source link

MacBook M2 docker image #142

Closed MichaelCade closed 1 year ago

MichaelCade commented 1 year ago

Hey there, just got myself a new M2 MBP and I believe we need the linux/arm64/v8 image for this to work, not sure if you want to implement this into the pipeline build I will try and compile locally and confirm this.

cooperspencer commented 1 year ago

Hi, I am kinda jealous, not gonna lie :smile: Please do and I'll do some research too.

cooperspencer commented 1 year ago

can you try to run buddyspencer/gickup:dev?

MichaelCade commented 1 year ago

I think the issue is my environment as the container doesnt seem to run but also having issues with running the binary locally as well

MichaelCade commented 1 year ago

The dev tag worked however I am seeing this behaviour when trying to send to a local folder

2023-03-01 17:20:00 2023-03-02T01:20:00Z INF Reading /gickup/conf.yml file=/gickup/conf.yml 2023-03-01 17:20:00 2023-03-02T01:20:00Z INF Configuration loaded destinations=0 pairs=0 sources=1 2023-03-01 17:20:00 2023-03-02T01:20:00Z INF Backup run starting 2023-03-01 17:20:00 2023-03-02T01:20:00Z INF grabbing my repositories stage=github url=https://github.com

2023-03-01 17:20:31 2023-03-02T01:20:31Z INF Backup run complete duration=30.752037389s But there is nothing in the folder the command I am running - docker run -d -v /Users/michaelcade/Documents/gickup/conf.yml:/gickup/conf.yml -v /Users/michaelcade/Documents/gickup/backup:/work buddyspencer/gickup:dev with my conf file looking like this local: # Export this path from Docker with a volume to make it accessible and more permanent. - path: /work structured: false # checks repos out like hostersite/user|organization/repo zip: true # zips the repository after cloned and removes the repository afterwards keep: 5 # only keeps x backups bare: false # clone the repositories as bare
cooperspencer commented 1 year ago

Is this your complete log? Did you see all your repositories at least in the logs? I am currently running a backup with the dev tag on my laptop and it works fine, with your local configuration.

MichaelCade commented 1 year ago

Yes I saw all my repositories I just removed them as there are some private ones I didn't want to share the names of.

So the conf file is working if I am getting them? I am using a GitHub Token to access but yes finishing after 30 seconds and no backup.

I also get the same if I run the binary locally.

cooperspencer commented 1 year ago

hmm... that should be fine actually. Are you running it with the same configuration with just the binary? Because then it would try to create the backup in /work and not in /Users/michaelcade/Documents/gickup/backup

cooperspencer commented 1 year ago
source:
  github:
    - user: cooperspencer

destination:
  local:
    - path: /work
      zip: true
      keep: 5

my config for comparison.

docker run -d -v /home/andreas.wachter/gickup-test/conf.yml:/gickup/conf.yml -v /home/andreas.wachter/gickup-test/backup:/work buddyspencer/gickup:dev

MichaelCade commented 1 year ago

I was changing the conf when running between binary and docker the location

Let me check the rest and get back

MichaelCade commented 1 year ago

Right so I am running

docker run -d -v /Users/michaelcade/Documents/gickup/conf.yml:/gickup/conf.yml -v /Users/michaelcade/Documents/gickup/backup:/work buddyspencer/gickup:dev

which then gives me the output above but with all my repositories listed

my conf file

source:
  github:
    - token: <I have my token specified here> 
      # alternatively, specify token in a file, relative to current working directory when executed.
      # token_file: token.txt
      user:  # the user you want to clone the repositories from.
      # if you want to get everything from your user, leave out the user parameter and just use the token.
      # for the clone process, either use:
      # - username + password
      # - sshkey
      # - token
      username:  # user is used to clone the repo with
      password: 
      ssh: false # can be true or false
      sshkey: # if empty, it uses your home directories' .ssh/id_rsa
      exclude: # this excludes the repos "foo" and "bar"
      include: # this includes the repo "foobar"
      excludeorgs: # this excludes repos from the organizations "foo" and "bar"
      includeorgs: # this includes repos from the organizations "foo1" and "bar1"
      wiki: true # includes wiki too
      starred:  # includes the user's starred repositories too
      filter:
        stars: # only clone repos with 100 stars
        lastactivity: # only clone repos which had activity during the last year
        excludearchived: true 
        languages: # only clone repositories with the following languages
  local: 
    # Export this path from Docker with a volume to make it accessible and more permanent.
    - path: /work
      structured: false # checks repos out like hostersite/user|organization/repo
      zip: true # zips the repository after cloned and removes the repository afterwards
      keep: 5 # only keeps x backups
      bare: false # clone the repositories as bare
  cron: # optional - when cron is not provided, the program runs once and exits.
# Otherwise, it runs according to the cron schedule.
# See timezone commentary in docker-compose.yml for making sure this container runs
# in the timezone you want.
# For more information on crontab or testing: https://crontab.guru/

  log: # optional
  timeformat: 2006-01-02 15:04:05 # you can use a custom time format, use https://yourbasic.org/golang/format-parse-string-time-date-example/ to check how date formats work in go
                                  # or set it as environment variable GICKUP_TIME_FORMAT
  file-logging: # optional
    dir: log # directory to log into
    file: gickup.log # file to log into
    maxage: 7 # keep logs for 7 days

  metrics:
  prometheus: # optional, needs to be provided in the first config
    endpoint: /metrics
    listen_addr: ":6178" # default listens on port 6178 on all IPs.
  heartbeat: # optional - upon successful backup, makes a GET http request to one or more URLs. This is useful for use with monitoring services such as healthchecks.io or deadmanssnitch.com
    urls:
# you can define separate source and destination pairs,
# like "mirror all repos from github to gitea but keep gitlab repos up-to-date in ~/backup"
# if cron is defined in the first config, this cron interval will be used for all the other confgurations, except it has one of its own.
# if cron is not enabled for the first config, cron will not run for any other configuration
# metrics configuration is always used from the first configuration

I expect I have missed something in the config file.

MichaelCade commented 1 year ago

Ah i just realised what it was!!!!

missed out the

destination:

from the conf file sorry all working now

cooperspencer commented 1 year ago

It's fine, I'll add a warning message if there are no destinations.