GithubHelp home page GithubHelp logo

sunsided / docker-nuget Goto Github PK

View Code? Open in Web Editor NEW
32.0 3.0 20.0 21 KB

A simple NuGet feed using docker

Home Page: https://hub.docker.com/r/sunside/simple-nuget-server/

License: MIT License

Shell 100.00%
docker nuget-server nuget-feed nuget

docker-nuget's Introduction

Docker NuGet Feed v0.5

This project provides a NuGet feed based on the simple-nuget-server project. It runs on top of the official nginx image and uses HHVM for PHP execution. Supervisor is used for tracking the processes.

The corresponding docker image is sunside/simple-nuget-server and can be found here.

NuGet packages currently are allowed to have a maximum size of 20 MB on upload.

Quickstart

docker run --detach=true \
           --publish 5000:80 \
           --env NUGET_API_KEY=<your secret> \
           --volume /srv/docker/nuget/database:/var/www/db \
           --volume /srv/docker/nuget/packages:/var/www/packagefiles \
           --name nuget-server \
           sunside/simple-nuget-server

Building the image

To build the image named simple-nuget-server, execute the following command:

docker build -t simple-nuget-server .

At build time, a random API key is generated and printed out to the console. Note that this implies that every new image has a different default API key.

Running the image

Make sure to have the submodule available by either cloning with git clone --recursive or executing

git submodule init
git submodule update

To run a container off the simple-nuget-server image, execute the following command:

docker run -d --name nuget-server -p 80:80 \
           -e NUGET_API_KEY=<your secret> simple-nuget-server

Note that some NuGet clients might be picky about the port, so be sure to have your feed available on either port 80 or 443, e.g. by having a reverse proxy in front on the container.

Environment configuration

  • NUGET_API_KEY sets the NuGet feed's API key to your own private key
  • BASE_URL sets the base path of the feed, e.g. /nuget if it is available under http://your.tld/nuget/
  • UPLOAD_MAX_FILESIZE (optional) sets the maximum allowed filesize when uploading NuGet packages via API. Default is 20M.

Exported volumes

  • /var/www/db contains the SQLite database
  • /var/www/packagefiles contains uploaded the NuGet packages
  • /var/cache/nginx nginx' cache files

NuGet configuration

In order to push a package to your new NuGet feed, use the following command:

nuget push -Source http://url.to/your/feed/ -ApiKey <your secret> path/to/package.nupkg

Deleting package version <Version> of package <Package> is done using

nuget delete -Source http://url.to/your/feed/ -ApiKey <your secret> <Package> <Version>

Listing packages including prereleases can be done using

nuget list -Source http://url.to/your/feed/ -Prerelease

You can add your feed to a specific NuGet.config file using:

nuget sources add -Name "Your Feed's Name" -Source http://url.to/your/feed/ -ConfigFile NuGet.config

In order to store the API key in a specifig NuGet.config file you can use:

nuget setapikey -Source http://url.to/your/feed/ -ConfigFile NuGet.config

This will create or update the apikeys section of your configuration file. Make sure to not check anything sensitive into source control.

In both cases, if you omit the -ConfigFile <file> option, your user configuration file will be used.

Apache example configuration

The following configuration sets up passwordless access from the local network 192.168.0.0/24 as well as the Docker network 172.17.42.0/24 and requires basic authentication from the outside world.

<Location /nuget/>
	Require all denied
	Require local
	Require ip 192.168.0.0/24
	Require ip 172.17.42.0/24

	AuthType Basic
	AuthName "NuGet Feed"
	AuthBasicProvider file
	AuthUserFile "/srv/docker/nuget/auth-file"
	Require valid-user

	RequestHeader set X-Forwarded-Proto "https"
	ProxyPass http://127.0.0.1:16473/nuget/
	ProxyPassReverse http://127.0.0.1:16473/nuget/
</Location>

License

This project is licensed under the MIT license. See the LICENSE file for more information.

docker-nuget's People

Contributors

insanity54 avatar sunsided avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-nuget's Issues

Only Deletes allowed

Hi,

I setup a docker server as the documentation describes, I can also push nuget packages into the server and see them on the filesystem /srv/www/packagesfiles but when I try to run

dotnet add package -s http://sulv082:8088/ drk.crm.api.common

it can not find the package. I also tried

dotnet add package -s http://sulv082:8088/index.php drk.crm.api.common

but then I get the "Only deletes allowed" message.

Where did I mess up? Any help would be appreciated :)

Best regards

nginx file size limit seems low

I was playing around with this and trying to push a .nupkg file that is 77MB. Got this error-

Failed to process request. 'Request Entity Too Large'.
The remote server returned an error: (413) Request Entity Too Large..

It looks like since client_max_body_size isn't set in https://github.com/sunsided/docker-nuget/blob/master/conf/nuget.conf, nginx sets it to a default of 20M which is too low for my use case.

EDIT

I see the Dockerfile sets the file limit. What do you think about the filesize limit being settable via ENV variable, similar to how BASE_URL can be set?

access-control question for running on AWS

Based on the behavior that I'm seeing, I think that I need to modify the access-control to allow the container to run on AWS. When I run the container locally, it appears to work fine.

nuget list -s http://localhost:5000
No packages found.

When I run the same container with the same settings on AWS, I get the following result.

nuget list -s http://nuget.service.mytld:5000
The remote server indicated that the previous request was forbidden. Please provide credentials for: http://nuget.service.mytld:5000

Any hints on how to configure Nginx / PHP to allow the same GET request would be very, very welcome.

HHVM Version not found...

when i run build.sh,some errors happen:

......
Package php5-mysql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5-sqlite is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Version '3.18.1~jessie' for 'hhvm' was not found
E: Package 'php5-mysql' has no installation candidate
E: Package 'php5-sqlite' has no installation candidate
The command '/bin/sh -c apt-get update && apt-get install -y gnupg && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 &&     echo deb http://dl.hhvm.com/debian $DEBIAN_VERSION main | tee /etc/apt/sources.list.d/hhvm.list &&     apt-get update &&     apt-get install -y --no-install-recommends hhvm=$HHVM_VERSION 	                                      php5-mysql php5-sqlite                                               supervisor' returned a non-zero code: 100

Timeout

I have a docker-compose.yml that looks like

version: '3.4'

services:
  nuget-server:
    image: sunside/simple-nuget-server
    environment:
      - NUGET_API_KEY=823281825
      - BASE_URL=/nuget
    volumes:
      - nuget-database:/var/www/db
      - nuget-packages:/var/www/packagefiles
    ports:
      - 56000:5000

volumes:
  nuget-database:  
  nuget-packages:

When I issue the command nuget push -Source http://localhost:56000/nuget -ApiKey 823281825 coremodels/1.0.0/coremodels.1.0.0.nupkg I get

Pushing coremodels.1.0.0.nupkg to 'http://localhost:56000/nuget'...
  PUT http://localhost:56000/nuget/
An error was encountered when fetching 'PUT http://localhost:56000/nuget/'. The request will now be retried.
The HTTP request to 'PUT http://localhost:56000/nuget/' has timed out after 300000ms.
A task was canceled.
  Pushing took too long. You can change the default timeout of 300 seconds by using the -Timeout <seconds> option with the push command.

I cannot see that I have started up the container or called nuget incorrectly. Can you see the cause of the timeout?

NUGET_API_KEY isn't honored

I tried a number of variations on API keys and none of them seemed to work. It wasn't until I logged into the container interactively that I was able to cat the inc/config.php and see the key actually being used by the server.

In the dockerfile I can see you're generating a random key here:

RUN echo $(date +%s | sha256sum | base64 | head -c 32; echo) > $APP_BASE/.api-key && \
    echo "Auto-Generated NuGet API key: $(cat $APP_BASE/.api-key)" && \
    sed -i $APP_BASE/inc/config.php -e "s/ChangeThisKey/$(cat $APP_BASE/.api-key)/"

...but there's nothing in there about using the param passed in. When I used the randomly generated key I was able to push packages successfully. My fear is that every time I recreate the container, my API key is going to change and I'll have to docker exec -it into the container to get it. HEre's my compose config:

nuget:
  image: sunside/simple-nuget-server
  restart: always
  environment:
    - NUGET_API_KEY:monkey
  ports:
    - "6040:80"
  volumes:
    - /vm/nuget/packages:/var/www/packagefiles
    - /vm/nuget/db:/var/www/db

Maybe I'm missing something?

In any case, thanks for posting this image.

Scripts Support

Uploading of scripts seem to be supported, but what is the SourceURL for the repo? It seems we cannot have the same URL for the ScriptSource and Source..

setup fail

hello!I run this command:
docker run -d
-p 5001:80
-e NUGET_API_KEY=mynuget
-v /srv/docker/nuget/database:/var/www/db
-v /srv/docker/nuget/packages:/var/www/packagefiles
--name nuget-server
sunside/simple-nuget-server
then : http://192.168.200.86:5001/, but i get the info below:
[29/May/2018:12:16:34 +0000] "GET /Packages(Id='runtime.native.System.Security.Cryptography.OpenSsl',Version='4.3.0') HTTP/1.1" 500 5 "-" "NuGet Client V3/4.5.0 (Microsoft Windows NT 10.0.17134.0, VS Community/15.0)" "-"
192.168.1.12 - - [29/May/2018:12:16:34 +0000] "GET /Packages(Id='runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple',Version='4.3.0') HTTP/1.1" 500 5 "-" "NuGet Client V3/4.5.0 (Microsoft Windows NT 10.0.17134.0, VS Community/15.0)" "-"
192.168.1.12 - - [29/May/2018:12:16:34 +0000] "GET /Packages(Id='runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl',Version='4.3.0') HTTP/1.1" 500 5 "-" "NuGet Client V3/4.5.0 (Microsoft Windows NT 10.0.17134.0, VS Community/15.0)" "-"
192.168.1.12 - - [29/May/2018:12:16:34 +0000] "GET /Packages(Id='runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl',Version='4.3.0') HTTP/1.1" 500 5 "-" "NuGet Client V3/4.5.0 (Microsoft Windows NT 10.0.17134.0, VS Community/15.0)" "-"
192.168.1.12 - - [29/May/2018:12:16:34 +0000] "GET /Packages(Id='runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl',Version='4.3.0') HTTP/1.1" 500 5 "-" "NuGet Client V3/4.5.0 (Microsoft Windows NT 10.0.17134.0, VS Community/15.0)" "-"
2018/05/29 12:16:56 [error] 17#17: *1 open() "/var/www/public/Packages" failed (2: No such file or directory), client: 192.168.1.12, server: localhost, request: "GET /Packages HTTP/1.1", host: "192.168.200.86:5001"

How can i resolve this question?
thanks

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.