Code Monkey home page Code Monkey logo

docker-devpi's Introduction

Devpi Docker Environment

Devpi is self-hosted pypi repository. This setup provides simple Docker environment. Just clone & go!

Prerequisites

Docker and docker compose installed. See:

Unless you add user to docker group you have to prepend docker and tools commands with sudo like

$ sudo docker compose up
$ sudo bin/start

Install & Run

$ git clone [email protected]:x2es/docker-devpi.git
$ cd docker-devpi
$ docker compose up

Run as service

Swarm doesn't accept pull_policy option in docker-compose.yml hence it have to be commented.

(once) $ docker swarm init
$ cd docker-devpi
$ docker build . -t devpi
$ bin/start
...
$ bin/stop

Unstopped Docker services will start at next boot.

See content of bin/start and bin/stop scripts for details and docker service --help

Usage

Publish with poetry

Setup repository "local"

(prj-dir) $ poetry config repositories.local http://localhost:3141/user/private

Publish

(prj-dir) $ poetry build
(prj-dir) $ poetry publish -r local -u user -p userpassword

Install with pip

$ pip install -i http://localhost:3141/user/private package-name

Usage cookbook

Create staging repositories in front of pypi.org

Configuration

See docker-compose.yml as reference.

Initialization

Container will be initialized on first run:

  • Once USER_NAME= and USER_PASSWORD= given: user will be created
  • Once INDEX_NAME= given: index will be created for USER_NAME= or root

By default devpi-init will initialize root/pypi repository and sync index with pypi.org. You may provide --no-root-pypi using INIT_EXTRA_ARGS= variable to avoid it.

Persistance

Provided docker-compose.yml persists server data using local volume devpi_server. As alternative you may mount local directory to container's SERVER_DIR

It's safe to recreate container once volume used.

In order to reset persisted data

docker volume rm devpi_server

Tools

bin/console

Spawn shell or invoke command in the running container (when started either by docker-compose up or swarm)

$ bin/console
$ bin/console devpi_server
$ bin/console devpi_server /usr/bin/env python3
$ bin/console devpi_server pip install foo

bin/log

(swarm only)

Check the output logs

$ bin/log
$ bin/log -f
$ bin/log devpi_server
$ bin/log devpi_server -f

see bin/log content for details

Chaining

$ bin/start && bin/wait-container devpi_server && bin/console devpi_server ls
$ bin/start && bin/log -f

Troubleshooting

Swarm: Service won't start

$ docker service ps --no-trunc devpi_server

or

$ (Ubuntu) journalctl -u docker.service

see https://stackoverflow.com/a/45373282/983232

Full cleanup

CAUTION it will cleanup all data related to devpi.

$ ( set -x; docker compose rm; docker volume rm devpi_server; docker image rm devpi )
or
$ ( set -x; sudo docker compose rm; sudo docker volume rm devpi_server; sudo docker image rm devpi )

docker-devpi's People

Contributors

x2es avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.