From 7477621596369045552ba6e01ec0aa1067401500 Mon Sep 17 00:00:00 2001 From: Abdur Rahman Date: Thu, 4 Sep 2025 06:16:43 +0000 Subject: [PATCH 1/7] Update Ahoy installation for ARM architecture --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 43e0607..6331330 100644 --- a/src/main.rs +++ b/src/main.rs @@ -190,8 +190,8 @@ fn main() -> Result<()> { println!("\n{} Installing Ahoy...", step_text("4."),); sh.change_dir(format!("/home/{username}")); - cmd!(sh, "sudo curl -LO https://github.com/ahoy-cli/ahoy/releases/download/v2.5.0/ahoy-bin-linux-amd64").run()?; - cmd!(sh, "mv ./ahoy-bin-linux-amd64 ./ahoy").run()?; + cmd!(sh, "sudo curl -LO https://github.com/ahoy-cli/ahoy/releases/download/v2.5.0/ahoy-bin-linux-arm64").run()?; + cmd!(sh, "mv ./ahoy-bin-linux-arm64 ./ahoy").run()?; cmd!(sh, "sudo chmod +x ./ahoy").run()?; println!("{}", success_text("✅ 4. Successfully installed Ahoy.")); From b6f07aa663bf6541b930ef093b4d915ef3d42c65 Mon Sep 17 00:00:00 2001 From: Abdur Rahman Date: Thu, 4 Sep 2025 06:23:20 +0000 Subject: [PATCH 2/7] Revert last commit --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6331330..43e0607 100644 --- a/src/main.rs +++ b/src/main.rs @@ -190,8 +190,8 @@ fn main() -> Result<()> { println!("\n{} Installing Ahoy...", step_text("4."),); sh.change_dir(format!("/home/{username}")); - cmd!(sh, "sudo curl -LO https://github.com/ahoy-cli/ahoy/releases/download/v2.5.0/ahoy-bin-linux-arm64").run()?; - cmd!(sh, "mv ./ahoy-bin-linux-arm64 ./ahoy").run()?; + cmd!(sh, "sudo curl -LO https://github.com/ahoy-cli/ahoy/releases/download/v2.5.0/ahoy-bin-linux-amd64").run()?; + cmd!(sh, "mv ./ahoy-bin-linux-amd64 ./ahoy").run()?; cmd!(sh, "sudo chmod +x ./ahoy").run()?; println!("{}", success_text("✅ 4. Successfully installed Ahoy.")); From 009e56b732838cf60315c7bde5bb8508bd4356e2 Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Thu, 4 Sep 2025 09:46:29 -0400 Subject: [PATCH 3/7] docs: mention ARM support plan --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0de466c..ecabf6e 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ > [!NOTE] > The `/etc/ckan/default/ckan.ini` config file will have its comments removed for now. There are plans to fix this in a future release of `ckan-devstaller`. +> [!NOTE] +> Currently `ckan-devstaller` supports x86 architecture. ARM support is planned. + You have two common options to choose from for installation. Paste one of the following scripts into your new Ubuntu 22.04 instance's terminal. ### Install with non-interactive mode (default config) From 83e8c2d423c659476a6fe0c952abe041c21992bc Mon Sep 17 00:00:00 2001 From: Abdur Rahman Date: Fri, 5 Sep 2025 05:03:03 +0000 Subject: [PATCH 4/7] Comment out CKAN user and sysadmin commands Comment out user addition and sysadmin commands in main.rs. --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 63f3da9..2a57815 100644 --- a/src/main.rs +++ b/src/main.rs @@ -262,12 +262,12 @@ fn main() -> Result<()> { println!("Existing users: {}", existing_users); //cmd!(sh, "ckan -c /etc/ckan/default/ckan.ini user remove existing_users").run().ok(); //cmd!(sh, "ckan -c /etc/ckan/default/ckan.ini search-index clear").run().ok(); - cmd!(sh, "ckan -c /etc/ckan/default/ckan.ini user add admin_ckan password=password email=admin@local").run()?; - cmd!( - sh, - "ckan -c /etc/ckan/default/ckan.ini sysadmin add admin_ckan" - ) - .run()?; + //cmd!(sh, "ckan -c /etc/ckan/default/ckan.ini user add admin_ckan password=password email=admin@local").run()?; + //cmd!( + // sh, + // "ckan -c /etc/ckan/default/ckan.ini sysadmin add admin_ckan" + //) + //.run()?; println!( "{}", success_text(format!("✅ 6. Installed CKAN {}.", config.ckan_version).as_str()) From 75c1e72f6503a38598791cfc9600a0736ce6460b Mon Sep 17 00:00:00 2001 From: Abdur Rahman Date: Fri, 5 Sep 2025 05:10:04 +0000 Subject: [PATCH 5/7] Modify unzip command to use '-o' option Update unzip command to overwrite existing files. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2a57815..e60a5ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -372,7 +372,7 @@ fn main() -> Result<()> { sh.change_dir(format!("/home/{username}")); cmd!(sh, "wget https://github.com/dathere/qsv/releases/download/4.0.0/qsv-4.0.0-aarch64-unknown-linux-gnu.zip").run()?; cmd!(sh, "sudo apt install unzip -y").run()?; - cmd!(sh, "unzip qsv-4.0.0-aarch64-unknown-linux-gnu.zip").run()?; + cmd!(sh, "unzip -o qsv-4.0.0-aarch64-unknown-linux-gnu.zip").run()?; cmd!(sh, "sudo rm -rf qsv-4.0.0-aarch64-unknown-linux-gnu.zip").run()?; //cmd!(sh, "sudo mv ./qsvdp_glibc-2.31 /usr/local/bin/qsvdp").run()?; cmd!(sh, "sudo mv ./qsvdp /usr/local/bin/qsvdp").run()?; From f7a1bba0f32c7718881da0e5d7628bb931a14afc Mon Sep 17 00:00:00 2001 From: Abdur Rahman Date: Fri, 5 Sep 2025 05:17:21 +0000 Subject: [PATCH 6/7] Comment out dataset schemas configuration command Comment out the command for dataset schemas configuration. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e60a5ed..f6f8957 100644 --- a/src/main.rs +++ b/src/main.rs @@ -385,7 +385,7 @@ fn main() -> Result<()> { "ckan config-tool /etc/ckan/default/ckan.ini -s app:main ckan.plugins={ckan_plugins}" ) .run()?; - cmd!(sh, "ckan config-tool /etc/ckan/default/ckan.ini -s app:main scheming.dataset_schemas=ckanext.datapusher_plus:dataset-druf.yaml").run()?; + //cmd!(sh, "ckan config-tool /etc/ckan/default/ckan.ini -s app:main scheming.dataset_schemas=ckanext.datapusher_plus:dataset-druf.yaml").run()?; // app_main_section.insert("ckan.plugins", ckan_plugins); // app_main_section.insert( // "scheming.dataset_schemas", From edb53cdc4e16d3cdeaad1e38cfde9b81ed719545 Mon Sep 17 00:00:00 2001 From: Abu Date: Fri, 5 Jun 2026 11:17:43 +0000 Subject: [PATCH 7/7] 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 --- CLAUDE.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 38 +++++++++++++++++++++++++++++++++++ install.bash | 2 +- src/main.rs | 4 ++-- 4 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..b9059c4 --- /dev/null +++ b/CLAUDE.md @@ -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 email= password= +/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini sysadmin add +``` diff --git a/README.md b/README.md index ecabf6e..b2ba3b3 100644 --- a/README.md +++ b/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 ``` +## 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 email= password= +/usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/ckan.ini sysadmin add +``` + +CKAN will be available at `http://localhost:5000`. + ## Demos ### Interactive customizable installation diff --git a/install.bash b/install.bash index 22f5fe0..c25873d 100644 --- a/install.bash +++ b/install.bash @@ -21,7 +21,7 @@ sudo chmod +x ./ckan-devstaller # Otherwise run ckan-devstaller in interactive mode flag=$1 -if [ $flag == "default" ]; then +if [ "$flag" == "default" ]; then ./ckan-devstaller --default else ./ckan-devstaller diff --git a/src/main.rs b/src/main.rs index f6f8957..fe577e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -229,7 +229,7 @@ fn main() -> Result<()> { venv.pip_upgrade("pip")?; venv.pip_install( 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 ) .as_str(), @@ -337,7 +337,7 @@ fn main() -> Result<()> { ); cmd!( 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()?; let mut conf = ini::Ini::load_from_file("/etc/ckan/default/ckan.ini")?;