Skip to content

Commit

Permalink
docs update, download script fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bsjerps committed Jul 30, 2024
1 parent d3d175a commit 4316b96
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
49 changes: 32 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PyPGIO - An IO generator for PostgreSQL based on the original pgio and SLOB
# Description

__PyPGIO__ is a Python based I/O generator for PostgreSQL databases.
The only purpose is to drive (a lot of) I/O from a database without requiring a lot of CPU resources.
The only purpose is to drive (a lot of) I/O from a Postgres database without requiring a lot of CPU resources.

It is based on, and uses some code from PGIO by Kevin Closson, see [PGIO](https://github.com/therealkevinc/pgio) for more details.

Expand All @@ -21,7 +21,7 @@ It is based on, and uses some code from PGIO by Kevin Closson, see [PGIO](https:

## Easy way

Assuming the prerequisites are met, the easiest way to install the latest version of _pypgio_ is to run the downloader command on your host:
Assuming the prerequisites are met, the easiest way to install the latest version of _PyPGIO_ is to run the downloader command on your host:

```
# Test if python3 works
Expand All @@ -34,37 +34,52 @@ curl https://raw.githubusercontent.com/bsjerps/pypgio/master/scripts/download |
# Download using downloader
curl https://raw.githubusercontent.com/bsjerps/pypgio/master/scripts/download | bash
# Check if pgio is installed
ls -al ~/bin/pgio
# Check if pypgio is installed
ls -al ~/bin/pypgio
```

## From GIT repo

Note that _PyPGIO_ is designed to run as a ZipApp package. Running directly from the git repository is not recommended. Instead, create the package from the repo:
Note that _PyPGIO_ is designed to run as a [ZipApp](https://docs.python.org/3/library/zipapp.html) package. Running directly from the git repository is not recommended. Instead, create the package from the repo:

```
# Clone the repository
git clone https://github.com/bsjerps/pypgio.git
cd pypgio
scripts/mkapp
ls -al ~/bin/pgio
ls -al ~/bin/pypgio
```

# Create database
See [create_db.sql](https://github.com/bsjerps/pypgio/blob/devel/scripts/create_db.sql) for details

# Setup the environment

_PyPGIO_ depends on the Python modules [psycopg](https://www.psycopg.org/) and [PrettyTable](https://pypi.org/project/prettytable/). These modules are not installed by default with Python. In order for _PyPGIO_ to work, it needs to run from a Python virtual environment in which these modules are installed.

To make life easier if you are not familiar with Python, _PyPGIO_ has a built-in installer module to setup the environment automatically. The virtual environment will be in ```$HOME/pgio_venv```

```
# Run pgio
pgio
# Show the installer help
python3 $HOME/bin/pypgio/install -h
# Setup virtualenv, pgio wrapper script and bash completions
python3 $HOME/bin/pypgio/install -h
# Run installer (this sets up the virtual environment and bash completion)
pgio install
# Uninstall virtualenv, wrapper script and completions file
python3 $HOME/bin/pypgio/install -u
# Logout and login again - bash completion should now work
# Or source the completions
source ~/.bash_completion
```

# Create database
See [create_db.sql](https://github.com/bsjerps/pypgio/blob/devel/scripts/create_db.sql) for details

# Setup the environment


```
# Run pgio
pgio
# Show help summary: Run pgio -h
pgio -h
Expand Down Expand Up @@ -127,17 +142,17 @@ pgio report -v

# Deinstall

Deinstallation involves the removal of all pgio related stuff in the database, and the virtual environment and shell settings in the user home directory
Deinstallation involves the removal of all pypgio related stuff in the database, and the virtual environment and shell settings in the user home directory

```
# Delete the database structures
pgio destroy
# Remove bash setup and virtual environment
pgio uninstall
python3 $HOME/bin/pypgio/install -u
# Remove pgio from $HOME/bin
rm ~/bin/pgio
# Remove pypgio from $HOME/bin
rm ~/bin/pypgio
```

Expand Down
4 changes: 2 additions & 2 deletions scripts/download
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

url=$(curl -s https://api.github.com/repos/bsjerps/pypgio/releases/latest | awk '/browser_download_url/ {print $NF}' | tr -d \")

wget -q $url -O ~/bin/pgio
chmod 755 ~/bin/pgio
wget -q $url -O ~/bin/pypgio
chmod 755 ~/bin/pypgio

0 comments on commit 4316b96

Please sign in to comment.