|
@@ -8,36 +8,6 @@ python-based website integrating a webshop (Stripe, NOWPayments) and git-based w
|
|
|
- FastAPI
|
|
- FastAPI
|
|
|
- custom parser for md + yaml documents
|
|
- custom parser for md + yaml documents
|
|
|
|
|
|
|
|
-## setup
|
|
|
|
|
-
|
|
|
|
|
-as the content repository is tracked with git, we're using git-annex to handle binary files. to setup this integration:
|
|
|
|
|
-
|
|
|
|
|
-- install `git annex` (see <https://git-annex.branchable.com/install/>)
|
|
|
|
|
- - if on Debian based systems, check the [NeuroDebian](http://neuro.debian.net) channel for a more up-to-date version of git-annex
|
|
|
|
|
-- add a `.gitattributes` file with the following:
|
|
|
|
|
-
|
|
|
|
|
-```
|
|
|
|
|
-* annex.largefiles=nothing
|
|
|
|
|
-*.png filter=annex annex.largefiles=anything
|
|
|
|
|
-*.jpg filter=annex annex.largefiles=anything
|
|
|
|
|
-*.pdf filter=annex annex.largefiles=anything
|
|
|
|
|
-*.epub filter=annex annex.largefiles=anything
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-add more file type as needed. after this, we don't need to track binary files with `git annex add` but we can simply use `git add`.
|
|
|
|
|
-
|
|
|
|
|
-- initialize the repo: `git init`, `git annex init`
|
|
|
|
|
-- then work with files with git (`git add`, `git mv`, `git rm`, etc)
|
|
|
|
|
-
|
|
|
|
|
-### git annex useful commands
|
|
|
|
|
-
|
|
|
|
|
-- general sync: `git annex sync --content`; this syncs both from your computer to the remote server and vice-versa (eg it does a pull and then a push)
|
|
|
|
|
-- list files: `git annex find`
|
|
|
|
|
-- get copy of file: `git annex get <filepath>` (or without filepath to get all listed files)
|
|
|
|
|
-- remove file: `git annex drop --force <filepath>` (or without `<filepath>` to remove all listed files)
|
|
|
|
|
- - we need to use `--force` because by default git-annex tries to keep at least 1 more copy of the file in another repo, before deleting the file; in eg, it acts as an archive-focused system. since we might not care about that, passing `--force` bypasses the normal mechanism
|
|
|
|
|
- - NB: using `git rm <filepath>` will not remove the file from the repo, only the symlink git-annex created for it; we can check this by doing `ls -l ./git/annex/objects/` and count how many items are in there
|
|
|
|
|
-
|
|
|
|
|
## development
|
|
## development
|
|
|
|
|
|
|
|
### settings.toml
|
|
### settings.toml
|
|
@@ -203,25 +173,8 @@ xz-utils tk-dev libffi-dev liblzma-dev`
|
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
GIT_WORK_TREE=/var/www/hardware.darkfi git checkout -f main
|
|
GIT_WORK_TREE=/var/www/hardware.darkfi git checkout -f main
|
|
|
```
|
|
```
|
|
|
- - make hook executable with `chmod +x hooks/post-receive`
|
|
|
|
|
|
|
+- make hook executable with `chmod +x hooks/post-receive`
|
|
|
- make folder for website at `/var/www/hardware.darkfi`; create a new git remote pointing to `<user>@<server-ip>:www-code.git` and then push to this remote (it should copy all files over to `/var/www/darkfi-webshop`)
|
|
- make folder for website at `/var/www/hardware.darkfi`; create a new git remote pointing to `<user>@<server-ip>:www-code.git` and then push to this remote (it should copy all files over to `/var/www/darkfi-webshop`)
|
|
|
- install nginx and copy sample file to `/etc/nginx/site-available/`; enable nginx site by making a symbolic link of it to `/etc/nginx/site-enabled/`: `sudo ln -s /etc/nginx/site-available/hardware.darkfi.nginx /etc/nginx/site-enabled/hardware.darkfi.nginx`
|
|
- install nginx and copy sample file to `/etc/nginx/site-available/`; enable nginx site by making a symbolic link of it to `/etc/nginx/site-enabled/`: `sudo ln -s /etc/nginx/site-available/hardware.darkfi.nginx /etc/nginx/site-enabled/hardware.darkfi.nginx`
|
|
|
-- install git-annex:
|
|
|
|
|
- - `sudo apt-get install neurodebian`
|
|
|
|
|
- - `sudo apt-get update`
|
|
|
|
|
- - `sudo apt install git-annex`
|
|
|
|
|
- make new file `/etc/systemd/system/darkfi.service` and copy sample
|
|
- make new file `/etc/systemd/system/darkfi.service` and copy sample
|
|
|
- `sudo systemctl enable darkfi`, `sudo systemctl start darkfi`
|
|
- `sudo systemctl enable darkfi`, `sudo systemctl start darkfi`
|
|
|
-
|
|
|
|
|
-- setup git user info for current user:
|
|
|
|
|
- - `git config --global user.email "you@example.com"`
|
|
|
|
|
- - `git config --global user.name "Your Name"`
|
|
|
|
|
-- make git bare repo for content:
|
|
|
|
|
- - `mkdir www-data`
|
|
|
|
|
- - `cd www-data && git init --bare www-data.git`
|
|
|
|
|
- - `git clone www-data.git content`
|
|
|
|
|
- - `cd content && git annex init`
|
|
|
|
|
- - add `post-receive` script to `~/www-data/www-data.git/hooks/`
|
|
|
|
|
- - run `chmod +x ~/www-data/www-data.git/hooks/post-receive`.
|
|
|
|
|
-
|
|
|
|
|
-this will synchronize the git checkout folder (at `~/www-data/content`) with the git bare repo we use for actual synchronization (at `~/www-data/www-data.git`).
|
|
|