Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
/ df2 Public archive

A former tool to manage and optimize defacto2.net

License

Notifications You must be signed in to change notification settings

Defacto2/df2

Repository files navigation

Important

This redundant repository was archived in September 2024 after Defacto2 discontinued its legacy Coldfusion build web application.

df2

Go Report Card GitHub release (latest SemVer) GitHub

The df2 program is a terminal tool for managing plus optimising the files and database of defacto2.net that is broken down into multiple parts.

The Defacto2 tool is the program to manage, maintain and optimise defacto2.net.
© 2020-23 Defacto2 & Ben Garrett
https://github.com/Defacto2/df2

Usage:
  df2 [flags]
  df2 [command]

Admin:
  approve     Approve the records that are ready to go live.
  fix         Fixes database entries and records.
  import      Import a .rar archive collection containing information NFO and text files.
  new         Manage files marked as waiting to go live (default).
  output      Generators for JSON, HTML, SQL and sitemap documents.
  proof       Manage records tagged as #releaseproof.

Drive:
  clean       Discover or clean orphan files.
  shrink      Reduces the space used in directories.

Remote:
  apis        Batch data synchronization with remote APIs.
  demozoo     Interact with Demozoo submissions.
  lookup      Lookup the file URL of a record's ID or UUID.
  test        Test various features of the website or database that cannot be fixed with automation.

Additional Commands:
  env         Show environment variables used for configuration.
  help        Help about any command

Flags:
      --ascii     suppress all ANSI color feedback
  -h, --help      help for df2
      --quiet     suppress all feedback except for errors
  -v, --version   version and information for this program

Use "df2 [command] --help" for more information about a command.

Install or update

df2 is built on Go and is packaged for Debian Linux.

# download the package
wget https://github.com/Defacto2/df2/releases/latest/download/df2.deb

# install or update the package
dpkg -i df2.deb

# test the new install
df2 --version

Dependencies

Dependency installation on Ubuntu

# required dependencies
sudo apt install -y ansilove imagemagick netpbm pngquant webp

# optional file archivers
sudo apt install -y arj lhasa unrar unzip

Database dependancy

The df2 program expects local access to the Defacto2 database.

Configuration

To view and test the database and directory configurations.

df2 config info

To change the configuration.

df2 config edit

Docker container

The Docker container runs on a Go container built in Debian Linux. The main purpose is unit testing and compiling of the Go source code in a Linux environment.

# change directory to the local repository
cd df2
# synchronize any remote repository tags
git pull 
# build the current directory as an image tagged as 'df2'
docker build --tag df2 . 
# run the image tagged as 'df2' with the container name 'df2-test'
docker run -it --name df2-test df2

Use the code on your own system

Confirm the installation of Go on Linux, WSL or macOS.

$ go version

go version go1.19.5 linux/amd64

Clone the Defacto2/df2 repository.

$ git clone [email protected]:Defacto2/df2.git

Cloning into 'df2'...

Run the df2 tool. It may take a moment on the first run as it downloads dependencies.

$ cd df2
$ go run . --version

  version  0.0.0 (developer build)
     path  /tmp/go-build3011510136/b001/exe/df2
   commit  unknown
     date  unknown
       go  v1.19.5 linux/amd64

Build the df2 tool (not usually required).

$ cd df2
$ go build
$ ./df2 --version

  version  0.0.0 (developer build)
     path  /home/ben/df2/df2
   commit  3352b5393353d4e09cf19f636d4be593d961cece
     date  2023 Jan 3, 02:01 UTC
       go  v1.19.5 linux/amd64

Releasing

GitHub Actions combined with GoReleaser handles the building process when new release tags are created.

All changes should be tested with the golangci-lint Go linters aggregator.

Usage tips

import

Use rsync to upload to the remote server.

# rsync -a  optional archive mode
# rsync -P  optional progress bar and keeps the partially transferred files
# some_archive.rar is a local file to upload
# user@[ip address] is the remote destination and user account with SSH access.
# :~/downloads will place the some_archive.rar to the user account downloads directory.
rsync -aP some_archive.rar user@[ip address]:~/downloads

On the remote server.

df2 import ~/downloads/some_archive.rar --limit=10