diff --git a/.gitignore b/.gitignore index 2dae4508..7a7c9d43 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,36 @@ venv /.idea /*.iml inventory_ec2 -.DS_Store \ No newline at end of file +.DS_Store + + +### ucla local + +# Conda environment artifacts +.env/ +.venv/ +conda-meta/ +*.conda +*.egg-info/ + +# Python bytecode +__pycache__/ +*.py[cod] +*.pyo + +# Pip-tools generated lockfile (optional to ignore) +# If you want reproducibility, keep this file checked in. +# If you want to force all devs to recompile, uncomment below: +# requirements.txt + +# pip-sync temporary install log +pip-log.txt + +# Molecule test artifacts +.molecule/ +*.retry +*.log + +# VSCode & Editor configs +.vscode/ +.idea/ \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml index 01f923db..2696f331 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -247,7 +247,7 @@ dataverse: custom_sampledataverses: "{{ playbook_dir }}/custom_sampledata/dataverses" custom_sampleusers: "{{ playbook_dir }}/custom_sampledata/users" custom_samplefiles: "{{ playbook_dir }}/custom_sampledata/files" - service_email: noreply@dataverse.yourinstitution.edu + service_email: noreply@dataverse.ucla.edu smtp: localhost # or the FQDN of your organization's SMTP relay solr: download_url: https://archive.apache.org/dist/solr/solr/9.8.0/solr-9.8.0.tgz diff --git a/environment.yml b/environment.yml index c6a5f0f3..29f6bd68 100644 --- a/environment.yml +++ b/environment.yml @@ -3,9 +3,5 @@ channels: - conda-forge dependencies: - python=3.11 - - ansible - - molecule - - docker-py - pip - - pip: - - molecule-docker + - pip-tools \ No newline at end of file diff --git a/requirements.in b/requirements.in new file mode 100644 index 00000000..d17ba25d --- /dev/null +++ b/requirements.in @@ -0,0 +1,4 @@ +ansible-core +molecule +molecule-docker +docker diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..b992eb06 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,107 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile requirements.in +# +ansible-compat==25.6.0 + # via molecule +ansible-core==2.19.0 + # via + # -r requirements.in + # ansible-compat + # molecule +attrs==25.3.0 + # via + # jsonschema + # referencing +bracex==2.6 + # via wcmatch +certifi==2025.7.14 + # via requests +cffi==1.17.1 + # via cryptography +charset-normalizer==3.4.2 + # via requests +click==8.2.2 + # via + # click-help-colors + # molecule +click-help-colors==0.9.4 + # via molecule +cryptography==45.0.5 + # via ansible-core +docker==7.1.0 + # via + # -r requirements.in + # molecule-docker +enrich==1.2.7 + # via molecule +idna==3.10 + # via requests +jinja2==3.1.6 + # via + # ansible-core + # molecule +jsonschema==4.25.0 + # via + # ansible-compat + # molecule +jsonschema-specifications==2025.4.1 + # via jsonschema +markdown-it-py==3.0.0 + # via rich +markupsafe==3.0.2 + # via jinja2 +mdurl==0.1.2 + # via markdown-it-py +molecule==25.7.0 + # via + # -r requirements.in + # molecule-docker +molecule-docker==2.1.0 + # via -r requirements.in +packaging==25.0 + # via + # ansible-compat + # ansible-core + # molecule +pluggy==1.6.0 + # via molecule +pycparser==2.22 + # via cffi +pygments==2.19.2 + # via rich +pyyaml==6.0.2 + # via + # ansible-compat + # ansible-core + # molecule +referencing==0.36.2 + # via + # jsonschema + # jsonschema-specifications +requests==2.32.4 + # via + # docker + # molecule-docker +resolvelib==1.2.0 + # via ansible-core +rich==14.1.0 + # via + # enrich + # molecule +rpds-py==0.26.0 + # via + # jsonschema + # referencing +subprocess-tee==0.4.2 + # via ansible-compat +typing-extensions==4.14.1 + # via referencing +urllib3==2.5.0 + # via + # docker + # requests +wcmatch==10.1 + # via molecule diff --git a/ucla_readme.md b/ucla_readme.md index ecbaf007..176008e4 100644 --- a/ucla_readme.md +++ b/ucla_readme.md @@ -1,44 +1,64 @@ -## Local setup (recommended) +## Local Setup (Recommended) These instructions assume: + - You have already cloned this repository locally: - ``` - git clone https://github.com/ucla-data-science-center/dataverse-ansible.git - cd dataverse-ansible - ``` -- You have [Conda](https://docs.conda.io/en/latest/miniconda.html) installed (e.g. via Miniforge or Miniconda). + + ```bash + git clone https://github.com/ucla-data-science-center/dataverse-ansible.git + cd dataverse-ansible + ``` + +- You have [Conda](https://docs.conda.io/en/latest/miniconda.html) installed (e.g. via [Miniforge](https://github.com/conda-forge/miniforge)). - Docker is installed and running on your system. --- -### Create the Conda environment +### 1. Create the Conda Environment -To create a consistent development environment, use the provided `environment.yml` file: +To create a consistent development environment using `pip-tools`: -``` -conda env create -f environment.yml -conda activate dataverse-ansible -``` + ```bash + conda env create -f environment.yml + conda activate dataverse-ansible + ``` -This will install Python 3.11, Ansible, Molecule, and Docker bindings. +This will install: + +- Python 3.11 +- `pip-tools` (to manage Python packages via lockfiles) --- -### Alternative: Manual environment creation +### 2. Compile and Install Python Dependencies + +This project uses [`pip-tools`](https://pip-tools.readthedocs.io/) for dependency management. After activating the environment: + + ```bash + pip-compile requirements.in + pip-sync + ``` -If you prefer not to use `environment.yml`, you can create the environment manually: +This will install: -``` -conda create -n dataverse-ansible python=3.11 -y -conda activate dataverse-ansible -conda install -c conda-forge ansible molecule docker-py -``` +- `ansible-core` +- `molecule` +- `molecule-docker` +- `docker` (Python SDK) -If you plan to use Vagrant with Molecule instead of Docker, install the vagrant plugin: +> You only need to run `pip-compile` again if `requirements.in` changes. Use `pip-sync` to reinstall the locked dependencies. -``` -pip install 'molecule[vagrant]' -``` +--- + +### Optional: Manual Environment Creation + +If you prefer not to use `environment.yml` or `pip-tools`, you can manually create and install dependencies: + + ```bash + conda create -n dataverse-ansible python=3.11 -y + conda activate dataverse-ansible + pip install ansible-core molecule molecule-docker docker + ``` --- @@ -48,27 +68,26 @@ The `rocky9` Molecule scenario uses Docker as a provisioner. It relies on a cust From the root of the cloned repository, run: -``` -molecule converge --scenario-name rocky9 -``` + ```bash + molecule converge --scenario-name rocky9 + ``` This will build a Docker container, install Dataverse, and configure services. Once complete, you should be able to access Dataverse at: -``` -http://localhost:8080 -``` + http://localhost:8080 + +**Default admin login:** -Default admin login: - **Username**: `dataverseAdmin` -- **Password**: defined in `tests/group_vars/vagrant.yml` (look for `dataverse_adminpass`) +- **Password**: defined in `tests/group_vars/vagrant.yml` (see `dataverse_adminpass`) To verify the server is responding: -``` -curl -I http://localhost:8080 -``` + ```bash + curl -I http://localhost:8080 + ``` --- @@ -78,41 +97,45 @@ Because the Dataverse installer is not idempotent, it’s recommended to fully r To stop and delete the container: -``` -molecule reset --scenario-name rocky9 -``` + ```bash + molecule reset --scenario-name rocky9 + ``` + +Then rebuild with: -Then rebuild with `molecule converge`. + ```bash + molecule converge --scenario-name rocky9 + ``` To open a shell inside the running container: -``` -molecule login --scenario-name rocky9 -``` + ```bash + molecule login --scenario-name rocky9 + ``` To see additional Molecule commands: -``` -molecule --help -``` + ```bash + molecule --help + ``` -More documentation: https://ansible.readthedocs.io/projects/molecule/ +More documentation: [https://ansible.readthedocs.io/projects/molecule/](https://ansible.readthedocs.io/projects/molecule/) --- ## Notes - If port `8080` is already in use on your machine, update the port mapping in `molecule/rocky9/molecule.yml`. -- Ensure Docker Desktop or your Linux Docker daemon is running before launching `molecule converge`. +- Ensure Docker Desktop (macOS) or the Docker daemon (Linux/WSL2) is running before launching `molecule converge`. --- -## Windows/WSL2 Linux specific changes +## Windows/WSL2 Linux Specific Changes -If you're using WSL2 with Debian Linux, make the following adjustments (branch: `windows_wsl2_jmj`): +If you're using WSL2 with Debian Linux, make the following adjustments (see branch: `windows_wsl2_jmj`): - In `minio.yml`, lines 68 and 79: - Change `community.docker.docker_compose` to `community.docker.docker_compose_v2` + Change `community.docker.docker_compose` → `community.docker.docker_compose_v2` - In `tasks/postgres_redhat.yml`, line 11: - Change `-aarch64` to `{{ ansible_distribution_major_version }}-x86_64` + Change `-aarch64` → `{{ ansible_distribution_major_version }}-x86_64` \ No newline at end of file