Skip to content
/ pwn Public

An author-first platform for online fiction.

License

Notifications You must be signed in to change notification settings

loganrios/pwn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PWN Redux

A web fiction platform for authors and readers, built with Biff and hosted at https://pwn.ink.

Open-Source Disclaimer

While PWN’s source code is publicly available, please note that this is for the purposes of transparency with our user community–not necessarily to encourage others to host their own instance of this application. You can certainly attempt to do so, but please note that this is not a use case that will be documented or explicitly supported.

That being said, PWN is released as Free (Libre) Software, and you have the right to do with this source code as you please, so long as the stipulations of the AGPL-3.0 License are properly observed.

Getting started

Prerequisites

For development, PWN requires Java, Clojure, and Babashka to be installed on the host machine. You must also have a config.edn file in the project root that looks something like this:

{:prod {} ;; all production keys go here
 :dev {:merge [:prod]
       :pwn/enable-beholder true

       :postmark/api-key nil
       :stripe/api-key ""
       :recaptcha/site-key nil
       :recaptcha/secret-key nil

       :biff/host "0.0.0.0"
       :biff/port 8080
       :biff/base-url "http://localhost:8080"
       :biff.xtdb/dir "storage/xtdb"
       :biff.xtdb/topology :standalone
       :biff.middleware/secure false}
 :tasks {:biff.tasks/tailwind-build nil
         :biff.tasks/main-ns pwn
         :biff.tasks/soft-deploy-fn pwn/on-save
         :biff.tasks/deploy-from "trunk"
         :biff.tasks/deploy-to "prod"
         :biff.tasks/server "<your-domain-name>"}}

Running in Development

In a shell, you can then run bb dev in the project root to get started. The application will then be available at https://localhost:8080. Files will be hot-reloaded upon change.

To connect to the running REPL with Emacs, run M-x cider-connect-clj (or SPC m c for Doom users), and select localhost followed by pwn:7888.

Running in Production

We use Alpine Linux for our production systems, but these steps could probably be easily adapted for any mainstream Linux distribution.

Note: pretty much all of this is adapted from Biff’s original setup.sh file. I haven’t yet figured out how to do the dev-in-prod thing that requires trenchman and all the systemd stuff.

DOMAIN=<your-domain-here>
apk update && apk upgrade
apk install tmux caddy bash rlwrap openjdk17-jre-headless rsync git

CLJ_VERSION=1.11.1.1200
curl -O https://download.clojure.org/install/linux-install-$CLJ_VERSION.sh
chmod +x linux-install-$CLJ_VERSION.sh
./linux-install-$CLJ_VERSION.sh
rm linux-install-$CLJ_VERSION.sh

BB_VERSION=1.0.168
curl -LO https://github.com/babashka/babashka/releases/download/v$BB_VERSION/babashka-$BB_VERSION-linux-amd64-static.tar.gz
tar -xf babashka-$BB_VERSION-linux-amd64-static.tar.gz
rm babashka-$BB_VERSION-linux-amd64-static.tar.gz
mv bb /usr/local/bin/

useradd -m app
mkdir -m 700 -p /home/app/.ssh
cp /root/.ssh/authorized_keys /home/app/.ssh
chown -R app:app /home/app/.ssh

su pwn
cd ~
cat > Caddyfile << EOD
$DOMAIN {
        reverse_proxy localhost:8080
}
EOD

# quit out from app user
exit

# close ssh connection
exit

rsync -avz pwn app@$DOMAIN:~/
ssh app@$DOMAIN
cd pwn

tmux
$(bb run-cmd)
# C-b d
caddy start
exit

Contributing

As this project is in pre-release, we are keeping development in-house at this time. Please look forward to future contributing guidelines as the project matures.

About

An author-first platform for online fiction.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published