Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"permissions": {
"allow": [
"Bash(python:*)"
]
}
}
18 changes: 9 additions & 9 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ clone:
recursive: false
tags: false
# This is explicitly set so that forks retain a constant path.
path: /drone/src/github.com/reddit/reddit-public
path: /drone/src/github.com/tippr/tippr-public

compose:
# Some of these aren't actively used, but are required in that import
Expand All @@ -19,25 +19,25 @@ compose:
privileged: true
image: postgres:9.3.12
environment:
POSTGRES_USER: reddit
POSTGRES_USER: tippr
POSTGRES_PASSWORD: password
POSTGRES_DB: reddit
POSTGRES_DB: tippr

cassandra:
privileged: true
# Cassandra 1.x is old enough not to have any official Docker images.
# In the meantime, we've got a custom image configured specifically for r2:
# https://github.com/reddit/docker-cassandra
# https://github.com/tippr/docker-cassandra
# We'll move over to the official images when we upgrade to C* 2.x.
image: reddit/cassandra:single-1.2.19-v1
image: tippr/cassandra:single-1.2.19-v1

rabbitmq:
# NOTE: Using 3.4.x instead of 3.2.4 due to tag availability.
image: rabbitmq:3.4
environment:
RABBITMQ_DEFAULT_VHOST: /
RABBITMQ_DEFAULT_USER: reddit
RABBITMQ_DEFAULT_PASS: reddit
RABBITMQ_DEFAULT_USER: tippr
RABBITMQ_DEFAULT_PASS: tippr

memcached:
# NOTE: Using 1.4.21 instead of 1.4.17 due to tag availability.
Expand All @@ -49,10 +49,10 @@ compose:
# Build steps are where the setup, compilation, and tests happen.
build:
# This is a fat Docker image with the apt dependencies pre-installed.
# https://github.com/reddit/docker-reddit-py
# https://github.com/tippr/docker-tippr-py
# Dependency changes in the install scripts can be optionally mirrored to the
# image for speedups, but abstaining from doing so won't break the builds.
image: reddit/reddit-py:latest
image: tippr/tippr-py:latest
# Always re-pull the image, since we're re-using the same tag.
pull: true
environment:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,60 @@
name: CI — Install Reddit (installer smoke)
name: CI — Install Tippr (installer smoke)

on:
push:
pull_request:

jobs:
install-reddit:
name: Run install/reddit.sh (smoke)
install-tippr:
name: Run install/tippr.sh (smoke)
runs-on: ubuntu-24.04
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache APT archives
uses: actions/cache@v4
with:
path: /var/cache/apt/archives
key: ${{ runner.os }}-apt-${{ hashFiles('install/install_apt.sh') }}
restore-keys: |
${{ runner.os }}-apt-

- name: Cache pip and pip wheels
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.cache/pip/wheels
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache source checkouts
uses: actions/cache@v4
with:
path: /home/runner/src
key: ${{ runner.os }}-src-${{ github.ref }}
restore-keys: |
${{ runner.os }}-src-

- name: Cache mcrouter build (/opt/mcrouter)
uses: actions/cache@v4
with:
path: /opt/mcrouter
key: ${{ runner.os }}-mcrouter-${{ github.ref }}
restore-keys: |
${{ runner.os }}-mcrouter-

- name: Cache ccache
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{ runner.os }}-ccache-${{ github.ref }}
restore-keys: |
${{ runner.os }}-ccache-

- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -25,25 +67,30 @@ jobs:
- name: Prepare venv and install baseplate (runner venv)
run: |
# Create a venv at the default location the installer will use
# Use actions/setup-python's Python which has working stdlib modules
python -m venv /home/runner/venv
# Ensure python3 symlink exists for compatibility with installer checks
ln -sf python /home/runner/venv/bin/python3 || true
# Verify the venv works (can import stdlib modules including math)
/home/runner/venv/bin/python -c "import sys, os, math; print('venv created successfully with Python', sys.version)"
/home/runner/venv/bin/pip install --upgrade pip setuptools wheel 'packaging>=23.1'
# Install the local baseplate checkout editable so builds find it
if [ -d ./baseplate.py ]; then
/home/runner/venv/bin/pip install -e ./baseplate.py
if [ -d ./tippr-baseplate.py ]; then
/home/runner/venv/bin/pip install -e ./tippr-baseplate.py
fi
# Install a packaging-compatible formenergy-observability fork early
/home/runner/venv/bin/pip install 'git+https://github.com/acalcutt/formenergy-observability.git@main#egg=formenergy-observability' || true
/home/runner/venv/bin/pip install 'git+https://github.com/TechIdiots-LLC/tippr-formenergy-observability.git@main#egg=formenergy-observability' || true

- name: Install reddit via installer (non-interactive)
- name: Install tippr via installer (non-interactive)
env:
# Prefer develop branch of baseplate for these smoke runs
REDDIT_BASEPLATE_PIP_URL: "git+https://github.com/acalcutt/baseplate.py.git@develop#egg=baseplate"
TIPPR_BASEPLATE_PIP_URL: "git+https://github.com/TechIdiots-LLC/tippr-baseplate.py.git@develop#egg=baseplate"
# Ensure a non-root runtime user exists in the installer
REDDIT_USER: "runner"
TIPPR_USER: "runner"
run: |
# The installer expects to run as root; run it under sudo and
# pipe a single 'Y' to answer the final confirmation prompt.
sudo -E bash -c "printf 'Y\n' | ./install/reddit.sh"
sudo -E bash -c "printf 'Y\n' | ./install/tippr.sh"

- name: Archive installer logs on failure
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-ubuntu-24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:

- name: Run unit tests (r2)
env:
DATABASE_URL: "postgresql://reddit:password@127.0.0.1/reddit"
DATABASE_URL: "postgresql://tippr:password@127.0.0.1/tippr"
run: |
# Run only unit tests for now - functional tests require full WSGI app setup
python -m pytest r2/r2/tests/unit -v --tb=short
Expand Down
127 changes: 95 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,125 @@
## Reddit Python 3 fork
# Tippr

This repository is a fork of the original reddit codebase updated
for modern systems. Highlights:
Tippr is a modern fork of the classic reddit codebase, updated for Python 3 and current Linux distributions.

- **Python:** Upgraded to Python 3 (tested with Python 3.12).
- **Platform:** Targeted for Ubuntu 24.04 (noble).
- **Compatibility:** Includes compatibility shims and updated install/build
scripts to work with current packaging and system tooling.
## About

This fork is intended for local development and experimentation. For the
original upstream project and documentation refer to the upstream repository.
This project is based on the open-source reddit codebase originally released under the Common Public Attribution License (CPAL). The original code is available at https://github.com/reddit-archive/reddit.

**Key Updates:**
- **Python 3:** Fully migrated to Python 3.12 from the original Python 2 codebase
- **Modern Platform:** Targeted for Ubuntu 24.04 LTS (Noble Numbat)
- **Updated Dependencies:** Modernized install scripts, compatibility shims, and build tooling for current packaging systems
- **Active Development:** Ongoing improvements and feature development by TechIdiots LLC

This fork is intended for local development, experimentation, and educational purposes.

## License

This project is licensed under the Common Public Attribution License Version 1.0 (CPAL), the same license as the original reddit code. See the [LICENSE](LICENSE) file for details.

**Attribution:** Based on reddit open-source code. Original code © 2006-2015 tippr Inc.

---

### Quickstart (Ubuntu 24.04)
## Quickstart (Ubuntu 24.04)

The following steps produce a development-ready environment on Ubuntu 24.04.

1. Create the runtime user (adjust `reddit` as needed):

### 1. Create the runtime user
```bash
useradd -m -s /bin/bash reddit
useradd -m -s /bin/bash tippr
```

2. Clone the repository:

### 2. Clone the repository
```bash
git clone https://github.com/acalcutt/reddit.git /opt/reddit
cd /opt/reddit
git clone https://github.com/TechIdiots-LLC/tippr.git /opt/tippr
cd /opt/tippr
```

3. Run the installer as root, specifying the user and domain:
### 3. Run the installer

Run as root, specifying the user and domain:
```bash
REDDIT_USER=reddit REDDIT_DOMAIN=reddit.local ./install-reddit.sh
TIPPR_USER=tippr TIPPR_DOMAIN=tippr.local ./install-tippr.sh
```

The installer will handle system dependencies, Python virtual environment setup, database configuration, and service installation. A Python venv is created at `/home/reddit/venv`.
The installer will:
- Install system dependencies
- Set up a Python virtual environment at `/home/tippr/venv`
- Configure databases (PostgreSQL, Cassandra)
- Install and configure supporting services (memcached, RabbitMQ, Zookeeper)
- Create systemd service units for the application stack

4. Add the domain to your hosts file (on the host machine if using a VM):
### 4. Configure DNS

Add the domain to your hosts file (on the host machine if using a VM):
```bash
echo "127.0.0.1 reddit.local" >> /etc/hosts
echo "127.0.0.1 tippr.local" >> /etc/hosts
```

### Configuration Options
### 5. Access the site

After installation completes and services start, visit `https://tippr.local` in your browser.

You can customize the install by setting environment variables:
## Configuration Options

Customize the installation by setting environment variables before running the installer:

| Variable | Default | Description |
|----------|---------|-------------|
| `REDDIT_USER` | (required) | User to run reddit as |
| `REDDIT_DOMAIN` | `reddit.local` | Domain for the site (must contain a dot) |
| `REDDIT_HOME` | `/home/$REDDIT_USER` | Base directory for install |
| `REDDIT_VENV` | `/home/$REDDIT_USER/venv` | Python virtual environment location |
| `REDDIT_PLUGINS` | `about gold` | Plugins to install |
| `TIPPR_USER` | (required) | User to run tippr as |
| `TIPPR_DOMAIN` | `tippr.local` | Domain for the site (must contain a dot) |
| `TIPPR_HOME` | `/home/$TIPPR_USER` | Base directory for install |
| `TIPPR_VENV` | `/home/$TIPPR_USER/venv` | Python virtual environment location |
| `TIPPR_PLUGINS` | `about gold` | Space-separated list of plugins to install |
| `PYTHON_VERSION` | `3.12` | Python version to use |

Example with custom settings:
```bash
TIPPR_USER=myuser TIPPR_DOMAIN=dev.tippr.local TIPPR_PLUGINS="about gold myaddon" ./install-tippr.sh
```

## Troubleshooting

### Locale Errors

If you encounter locale errors during PostgreSQL database creation:
```bash
localedef -i en_US -f UTF-8 en_US.UTF-8
```

### Notes
### Domain Requirements

The domain must contain a dot (e.g., `tippr.local`) as browsers don't support cookies for dotless domains like `tippr` or `localhost`.

### Service Management

Check service status:
```bash
systemctl status tippr-serve
systemctl status tippr-websockets
systemctl status tippr-activity
```

View logs:
```bash
journalctl -u tippr-serve -f
```

## Documentation

For detailed installation information, see [INSTALL_tippr.md](INSTALL_tippr.md).

## Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

## Credits

- **Original Code:** reddit Inc. (2006-2015)
- **Python 3 Migration & Modernization:** TechIdiots LLC (2024-2026)

---

- If you encounter locale errors when creating the Postgres DB, run: `localedef -i en_US -f UTF-8 en_US.UTF-8`
- The domain must contain a dot (e.g., `reddit.local`) as browsers don't support cookies for dotless domains.
**Note:** This is a development/experimental fork. For the original reddit codebase and historical documentation, see https://github.com/reddit-archive/reddit
10 changes: 5 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
![white hat trophy](https://b.thumbs.redditmedia.com/n0_7BYpCg_RYB1j7.png)

Like all pieces of software, reddit has bugs – and it always will. Some
Like all pieces of software, tippr has bugs – and it always will. Some
of them will take the form of security vulnerabilities.

If you find a security vulnerability in reddit, please privately report it to
[security@reddit.com](mailto:security@reddit.com). We'll get back to you ASAP,
If you find a security vulnerability in tippr, please privately report it to
[security@tippr.net](mailto:security@tippr.net). We'll get back to you ASAP,
usually within 24 hours.

Once the issue is fixed, if you provide your reddit username, we'll credit your
account with a [whitehat](https://www.reddit.com/wiki/whitehat) trophy.
Once the issue is fixed, if you provide your tippr username, we'll credit your
account with a [whitehat](https://www.tippr.net/wiki/whitehat) trophy.

Thank you and good hunting.
Loading
Loading