Skip to content

Commit

Permalink
Release 1.3.0: Added configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Casabianca committed Jul 29, 2015
2 parents 02a28e8 + f7876af commit 28d7864
Show file tree
Hide file tree
Showing 12 changed files with 228 additions and 89 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Semantic changelog: https://github.com/c4s4/changelog

- version: 1.3.0
date: 2015-07-29
summary: Added configuration file
added:
- "Added configuration file."
- "Added configuration file sample to run as a service."
removed:
- "No more options on command line (you can only pass the path to
configuration file."
fixed:
- "Added URL path to redirection shop (thus defaults to
*http://pypi.python.org/simple* instead of *http://pypi.python.org*)."

- version: 1.2.0
date: 2015-07-28
summary: Added basic authentication
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ build:
sed -e s/UNKNOWN/$(VERSION)/ $(NAME).go > $(BUILD_DIR)/$(NAME).go
cd $(BUILD_DIR) && go build $(NAME).go

run: build
run: clean build
@echo "$(YELLOW)Run Cheese Shop$(CLEAR)"
$(BUILD_DIR)/$(NAME)
$(BUILD_DIR)/$(NAME) etc/cheeseshop.yml

compile: clean
@echo "$(YELLOW)Generating binaries for all platforms$(CLEAR)"
mkdir -p $(BUILD_DIR)/$(NAME)-$(VERSION)
mkdir -p $(BUILD_DIR)/$(NAME)-$(VERSION)/bin
sed -e s/UNKNOWN/$(VERSION)/ $(NAME).go > $(BUILD_DIR)/$(NAME).go
cd $(BUILD_DIR) && gox -output=$(NAME)-$(VERSION)/$(NAME)-{{.OS}}-{{.Arch}}
cd $(BUILD_DIR) && gox -output=$(NAME)-$(VERSION)/bin/$(NAME)-{{.OS}}-{{.Arch}}

archive: compile
@echo "$(YELLOW)Generating distribution archive$(CLEAR)"
cp LICENSE.txt $(BUILD_DIR)/$(NAME)-$(VERSION)
cp -r LICENSE.txt etc/ $(BUILD_DIR)/$(NAME)-$(VERSION)
md2pdf README.md && mv README.pdf $(BUILD_DIR)/$(NAME)-$(VERSION)
changelog to html style > $(BUILD_DIR)/$(NAME)-$(VERSION)/CHANGELOG.html
cd $(BUILD_DIR) && tar cvf $(NAME)-$(VERSION).tar $(NAME)-$(VERSION)/*
Expand Down
68 changes: 53 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,82 @@ CheeseShop is a Python package repository.
Installation
------------

Download binary archive at <https://github.com/c4s4/cheeseshop/releases>, unzip it and copy the binary executable for your platform (named *cheeseshop*) somewhere in yout *PATH* and rename it *cheeseshop*. This executable doesn't need any dependency or virtual machine to run.
Download binary archive at <https://github.com/c4s4/cheeseshop/releases>, unzip it and copy the binary executable for your platform (named *cheeseshop-system-platform* in the *bin* directory) somewhere in yout *PATH* and rename it *cheeseshop*. This executable doesn't need any dependency or virtual machine to run.

There are binaries for following platforms:

- Linux 386, amd64 and arm.
- FreeBSD 386, amd64 and arm.
- NetBSD 386, amd64 and arm.
- OpenBSD 386 and amd64.
- Darwin 386 and amd64.
- Darwin (MacOSX) 386 and amd64.
- Windows 386 and amd64.
- Plan9 386 and amd64.

Usage
-----

To run the server, type on command line :
To run CheeseShop, type on command line:

cheeseshop -port 8000 -path simple -root . -shop http://pypi.python.org
$ cheeseshop

Options on command line :
It will look for a configuration file at following locations:

- *-port* to set the port the server is litening (default to *8000*).
- *-path* to set the URL path (defaults to *simple*).
- *-root* to set the directory where packages are living (defaults to current directory).
- *-shop* to set the URL of the shop for packages that are not found.
- *-auth* to set the path to the authentication file
- *~/.cheeseshop.yml*
- */etc/cheeseshop.yml*

The server outputs logs on the terminal. To get help on the console, type `cheeseshop -help`.
You may also pass the path to the configuration file on the command line:

The authentication file is made of lines with the username and the MD5 sum of the password separated with a space, such as (for user *foo* with password *bar*):
$ cheeseshop /path/to/cheeseshop.yml

foo 37b51d194a7513e45b56f6524f2d51f2
This configuration file should look like this:

# The port CheeseShop is listening
port: 8000
# The URL path
path: simple
# The root directory for packages
root: repo
# Redirection when not found
shop: http://pypi.python.org/simple
# List of users and their MD5 hashed password
# To get MD5 sum for password foo, type 'echo -n foo | md5sum'
# To disable auth when uploading packages, set auth to ~
auth:
spam: acbd18db4cc2f85cedef654fccc4a4d8
eggs: 37b51d194a7513e45b56f6524f2d51f2

To compute MD5 sum for a given password, in order to fill the authentication file, you may type following command :

$ echo -n foo | md5sum
acbd18db4cc2f85cedef654fccc4a4d8 -
$ echo -n bar | md5sum
37b51d194a7513e45b56f6524f2d51f2 -

If no *-auth* option is set on command line, you won't have to authenticate to upload a package to *CheeseShop*.
There is a sample configuration file in *etc* directory of the archive.

Service
-------

To install CheeseShop as a System V service, edit sample init script in *etc/cheeseshop.init* file. You should edit *SCRIPT* variable to set the path to the *cheeseshop* command. Then copy this file as */etc/init.d/cheeseshop*.

You must also edit configuration file *etc/cheeseshop.yml* to set the repository location in the *root* variable. Copy this file in */etc/cheeseshop.yml* location.

You can then start the service with:

$ sudo service cheeseshop start

And stop it with:

$ sudo service cheeseshop stop

You can view the logs in */var/log/cheeseshop.log* file.

To start the service at boot, you should type:

$ sudo update-rc.d cheeseshop defaults

And to disable start at boot:

$ sudo update-rc.d -f cheeseshop remove

*Enjoy!*
Loading

0 comments on commit 28d7864

Please sign in to comment.