Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update nexus, add pypi #159

Closed
wants to merge 2 commits into from
Closed

Conversation

manics
Copy link
Member

@manics manics commented Dec 2, 2019

  • Reset the admin password on new installations (default in the current upstream Docker image is a random string)
  • Use nexus-cli to create repositories. This should also allow cleanup-policies to be configured for new repositories (it won't modify the policy on existing ones, nor will it modify an existing policy with the same name).
$ docker-compose build nexus
$ docker-compose up nexus

When Nexus displays the Started Sonatype Nexus OSS 3.19.1-01 message

docker-compose exec nexus /initialise-repos.py

This will update the admin password and stop nexus only if necessary, otherwise it'll create repositories only if they don't exist.
If nexus was stopped restart it and rerun the script.

/initialise-repos.py won't modify existing objects so it's safe to always run.


To push to the repo inside devspace (https://help.sonatype.com/repomanager3/formats/pypi-repositories#PyPIRepositories-ConfiguringPyPIClientTools):

# cat << EOF > ~/.pypirc
[distutils]
index-servers =
    pypi

[pypi]
repository: http://nexus:8081/nexus/repository/pypi-internal/
username: admin
password: admin123
EOF
# git clone https://github.com/ome/omego
# cd omego
# python setup.py sdist bdist_wheel
# twine upload dist/*
Uploading distributions to http://nexus:8081/nexus/repository/pypi-internal/
Uploading omego-0.7.1.dev0-py3-none-any.whl
100%|███████████████████████████████████████| 40.1k/40.1k [00:00<00:00, 135kB/s]
Uploading omego-0.7.1.dev0.tar.gz
100%|███████████████████████████████████████| 36.1k/36.1k [00:00<00:00, 315kB/s]

To install from the repo inside devspace:

# pip install --trusted-host nexus --extra-index-url http://nexus:8081/nexus/repository/pypi-internal/simple omego==0.7.1.dev0
Looking in indexes: https://pypi.org/simple, http://nexus:8081/nexus/repository/pypi-internal/simple
Collecting omego==0.7.1.dev0
  Downloading http://nexus:8081/nexus/repository/pypi-internal/packages/omego/0.7.1.dev0/omego-0.7.1.dev0-py3-none-any.whl
Collecting yaclifw>=0.1.1
  Downloading https://files.pythonhosted.org/packages/48/58/f6ae8938d8726f9ba91a5245a02413953a62ce09aae01345b0ef189925b1/yaclifw-0.2.0.tar.gz
Requirement already satisfied: future in /usr/local/lib/python3.8/site-packages (from omego==0.7.1.dev0) (0.18.2)
Requirement already satisfied: six in /usr/local/lib/python3.8/site-packages (from yaclifw>=0.1.1->omego==0.7.1.dev0) (1.13.0)
Building wheels for collected packages: yaclifw
  Building wheel for yaclifw (setup.py) ... done
  Created wheel for yaclifw: filename=yaclifw-0.2.0-cp38-none-any.whl size=14608 sha256=2e950141514df47b758bf2e57ff73f4e8b1a46830ab8b0215e8ef846a357e7f5
  Stored in directory: /root/.cache/pip/wheels/b4/61/a3/30d948e563cffa78d54a7c9d1d97e69342d28499e116f2b587
Successfully built yaclifw
Installing collected packages: yaclifw, omego
Successfully installed omego-0.7.1.dev0 yaclifw-0.2.0

--trusted-host nexus is needed inside devspace because it's using a http connection. You could also pass --index-url if you want to disable the default pypi.

@manics manics changed the title Update nexus Update nexus, add pypi Dec 2, 2019
@manics manics changed the title Update nexus, add pypi WIP: Update nexus, add pypi Dec 2, 2019
@manics manics force-pushed the nexus-pypi branch 3 times, most recently from e89ab21 to 18b05ab Compare December 10, 2019 15:38
Reset the admin password on new installations (default in the current upstream Docker image is a random string)
Use nexus-cli to create repositories. This should also allow cleanup-policies to be configured but it's broken due to a bug in nexus-cli.
@manics manics changed the title WIP: Update nexus, add pypi Update nexus, add pypi Dec 10, 2019
@manics manics changed the title Update nexus, add pypi WIP: Update nexus, add pypi Dec 10, 2019
@manics
Copy link
Member Author

manics commented Dec 10, 2019

@manics
Copy link
Member Author

manics commented Jun 4, 2020

Todo: three repositories following https://help.sonatype.com/repomanager3/formats/pypi-repositories#PyPIRepositories-ProxyingPyPIRepositories

  • internal for custom CI builds
  • proxy default pypi
  • public group pypi that merges the aboe two repositories with the required precedence

@sbesson
Copy link
Member

sbesson commented Mar 10, 2022

Closing as this is still WIP and conflicts but the feature proposed here are still useful for deploying a production deployment and this might something worth revisiting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants