mirror of
https://github.com/dathere/ckan-devstaller.git
synced 2026-07-05 16:52:19 +00:00
Fix pip 26+ egg fragment syntax, add ARM build docs
- Fix unquoted $flag in install.bash (unary operator error when no arg) - Fix pip install syntax: use PEP 440 direct URL format for CKAN and ckanext-scheming (pip 26+ rejects extras in #egg= fragment) - Add CLAUDE.md with architecture notes, known issues, and sysadmin setup - Add deployment-from-source section to README for ARM users Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f7a1bba0f3
commit
edb53cdc4e
4 changed files with 98 additions and 3 deletions
57
CLAUDE.md
Normal file
57
CLAUDE.md
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
# ckan-devstaller
|
||||||
|
|
||||||
|
Rust CLI that installs CKAN 2.11.3 from source on Ubuntu 22.04. Two modes: interactive (prompts) or `--default` (silent).
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo build --release
|
||||||
|
./target/release/ckan-devstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
Requires Rust. Install via `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`.
|
||||||
|
|
||||||
|
## Source layout
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|------|---------|
|
||||||
|
| `src/main.rs` | CLI entry, `Config` struct, full install orchestration (~499 lines) |
|
||||||
|
| `src/questions.rs` | `inquire`-based interactive prompts (SSH, CKAN version, sysadmin) |
|
||||||
|
| `src/steps.rs` | Step display helpers (intro, numbered steps) |
|
||||||
|
| `src/styles.rs` | Terminal color helpers via `owo-colors` |
|
||||||
|
| `install.bash` | Bootstrap script: apt update, curl binary from releases, run installer |
|
||||||
|
|
||||||
|
## Key dependencies
|
||||||
|
|
||||||
|
- `clap` — CLI arg parsing (`--default` flag)
|
||||||
|
- `inquire` — interactive terminal prompts (requires real TTY)
|
||||||
|
- `xshell` / `xshell-venv` — shell command execution and Python venv management
|
||||||
|
- `rust-ini` — read/write `/etc/ckan/default/ckan.ini`
|
||||||
|
- `human-panic` — friendly panic messages
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
`main.rs` builds a `Config` struct (either from prompts or defaults), then runs install steps sequentially:
|
||||||
|
|
||||||
|
1. `apt update && apt upgrade`
|
||||||
|
2. Install curl + optional openssh-server
|
||||||
|
3. Install Ahoy CLI (arm64 or x86_64 binary from GitHub releases)
|
||||||
|
4. Clone and start ckan-compose (PostgreSQL, Solr, Redis via Docker)
|
||||||
|
5. Create Python venv at `/usr/lib/ckan/default`, install CKAN via pip
|
||||||
|
6. Set up `/etc/ckan/default/ckan.ini`
|
||||||
|
7. Set up DataStore (DB permissions, config)
|
||||||
|
8. Optionally install ckanext-scheming, DataPusher+
|
||||||
|
9. Start CKAN dev server
|
||||||
|
|
||||||
|
## Known issues / fixes applied
|
||||||
|
|
||||||
|
- **pip 26+ incompatibility**: `#egg=pkg[extras]` fragment syntax rejected. Fixed to use PEP 440 direct URL syntax: `pkg[extras] @ git+https://...`
|
||||||
|
- **ARM support**: Release binaries are x86_64. On ARM (e.g. Apple Silicon Ubuntu VM), build from source with `cargo build --release`.
|
||||||
|
- **install.bash unquoted variable**: `$flag` must be quoted in the `if` check to avoid `unary operator expected` error when no arg is passed.
|
||||||
|
|
||||||
|
## Adding a sysadmin after install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini user add <username> email=<email> password=<password>
|
||||||
|
/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini sysadmin add <username>
|
||||||
|
```
|
||||||
38
README.md
38
README.md
|
|
@ -36,6 +36,44 @@ wget -O - https://github.com/dathere/ckan-devstaller/releases/download/0.2.0/ins
|
||||||
wget -O - https://github.com/dathere/ckan-devstaller/releases/download/0.2.0/install.bash | bash
|
wget -O - https://github.com/dathere/ckan-devstaller/releases/download/0.2.0/install.bash | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Deployment (build from source)
|
||||||
|
|
||||||
|
Use this path when the release binary does not match your architecture (e.g. ARM / Apple Silicon).
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- Ubuntu 22.04 (fresh instance)
|
||||||
|
- Rust toolchain
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
source ~/.cargo/env
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build and run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/dathere/ckan-devstaller.git
|
||||||
|
cd ckan-devstaller
|
||||||
|
cargo build --release
|
||||||
|
./target/release/ckan-devstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
Pass `--default` for non-interactive mode:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./target/release/ckan-devstaller --default
|
||||||
|
```
|
||||||
|
|
||||||
|
### Add a sysadmin after install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini user add <username> email=<email> password=<password>
|
||||||
|
/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini sysadmin add <username>
|
||||||
|
```
|
||||||
|
|
||||||
|
CKAN will be available at `http://localhost:5000`.
|
||||||
|
|
||||||
## Demos
|
## Demos
|
||||||
|
|
||||||
### Interactive customizable installation
|
### Interactive customizable installation
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ sudo chmod +x ./ckan-devstaller
|
||||||
# Otherwise run ckan-devstaller in interactive mode
|
# Otherwise run ckan-devstaller in interactive mode
|
||||||
flag=$1
|
flag=$1
|
||||||
|
|
||||||
if [ $flag == "default" ]; then
|
if [ "$flag" == "default" ]; then
|
||||||
./ckan-devstaller --default
|
./ckan-devstaller --default
|
||||||
else
|
else
|
||||||
./ckan-devstaller
|
./ckan-devstaller
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ fn main() -> Result<()> {
|
||||||
venv.pip_upgrade("pip")?;
|
venv.pip_upgrade("pip")?;
|
||||||
venv.pip_install(
|
venv.pip_install(
|
||||||
format!(
|
format!(
|
||||||
"git+https://github.com/ckan/ckan.git@ckan-{}#egg=ckan[requirements]",
|
"ckan[requirements] @ git+https://github.com/ckan/ckan.git@ckan-{}",
|
||||||
config.ckan_version
|
config.ckan_version
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
|
|
@ -337,7 +337,7 @@ fn main() -> Result<()> {
|
||||||
);
|
);
|
||||||
cmd!(
|
cmd!(
|
||||||
sh,
|
sh,
|
||||||
"pip install -e git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming"
|
"pip install -e ckanext-scheming @ git+https://github.com/ckan/ckanext-scheming.git"
|
||||||
)
|
)
|
||||||
.run()?;
|
.run()?;
|
||||||
let mut conf = ini::Ini::load_from_file("/etc/ckan/default/ckan.ini")?;
|
let mut conf = ini::Ini::load_from_file("/etc/ckan/default/ckan.ini")?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue