Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Removed legacy version
Browse files Browse the repository at this point in the history
Healthcheck src check unnecessary with proxy
  • Loading branch information
DeanAyalon committed May 11, 2024
1 parent 8d5447a commit 8d80fe7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- release/*
paths:
- dockerfile
- files
- files/**

jobs:
release:
Expand Down
26 changes: 2 additions & 24 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
profiles:
- dev

# Uses the beta version of Verdaccio - No errors were observed
verdaccio-beta:
extends:
file: compose.dev.yml
Expand All @@ -35,27 +36,4 @@ services:
profiles:
- beta
build:
dockerfile: dockerfile.beta


# Old configuration - Uses nginx-v1
verdaccio-v1:
extends:
file: compose.base.yml
service: verdaccio
profiles:
- v1
image: jackdeaniels/private:verdaccio-v1
container_name: verdaccio-v1
ports:
- ${HOST_PORT:-4873}:4873
volumes:
- ./mounts/v1/conf:/verdaccio/conf:ro
- ${STORAGE:-./mounts/live/storage}:/verdaccio/storage
- ${CERTS:-./mounts/live/certs}:/verdaccio/certs:ro
environment:
- VERDACCIO_PROTOCOL=https
- DOMAIN=${DOMAIN:?}
- HOST_PORT=${HOST_PORT:-4873}
- PROXY_PORT=${PROXY_PORT:-${HOST_PORT:-4873}}

dockerfile: dockerfile.beta
17 changes: 2 additions & 15 deletions files/scripts/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,14 @@ check_site() {
temp_file=$(mktemp)
$req > "$temp_file" || exit 1

echo Server is up, checking src
echo This check needs updating....
echo Marking container as healthy

# TODO: IMPLEMENT BETTER CHECKING, AND MAKE SURE THE CORRECT URL IS IN SCRIPTS
# host_err=$(grep "localhost" "$temp_file")
# rm $temp_file

# if [ ! -z "$host_err" ]; then
# echo "Script src incorrectly set to localhost"
# exit 1
# else
# echo "Site is responsive"
# exit 0
# fi
echo Server is up and accessible
}

main() {
echo Starting Verdaccio healthcheck
check_env
check_site
echo "Container is healthy :)"
}

main
70 changes: 29 additions & 41 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,58 @@ This is the repository managing my own [Verdaccio](https://github.com/verdaccio/
The server is private and allows no public access, the code is shared for public reference.<br>
This repository is part of the larger [dean-server](https://github.com/DeanAyalon/dean-server) monorepo, and can be ran from there as well as an individual repository.

## Table of Contents

1. [What is this?](#what-is-this)
2. [Running](#running)
- [Configuration](#configuration)
- [Environment](#environment)
- [Standalone - Certificates](#standalone---certificates)
- [Use](#use)
- [v1](#v1)
- [HTTP - Unchecked](#http----unchecked)
3. [Contact](#contact)
4. [Thanks](#thanks)



# Running
## Pre-Running
### Requirements
# Use
## Requirements
- Docker Engine or Docker Desktop, with Docker Compose installed (Built in)
- This repository uses the new `docker compose`, it is unknown how well it would work with legacy `docker-compose` versions

### Environment
`docker compose` uses `.env` to build the containers according to your needs, make sure it's configured, duplicate [template.env](./template.env) to start

### Standalone - Certificates
When running this container without a proxy, Verdaccio needs access to the certificates to serve through HTTPS.
- Use single-domain certificates
- Use fullchain, not cert or chain
- Name the files: `fullchain.pem` and `privkey.pem` within the mount
> healthcheck.sh calls the following url:
> `https://$DOMAIN:$PROXY_PORT`
> If PROXY_PORT is undefined, HOST_PORT will be used, or 4873 as default.
### Configuration
If you are not me, and want to fork this repository, make sure to [configure verdaccio](./mounts/live/conf/config.yaml) for your own needs.<br>
By default, only a single user is allowed to register, and package access is specifically configured for my own use.

- To run without a proxy, see [alternate configurations](#alternate-configuration)

## Use
## Run
Docker compose can be ran from the context of this repository, but it is recommended to use it from the content of the entire [dean-server](https://github.com/DeanAyalon/dean-server) monorepo

### It is recommended to use this repository paired with [dean-nginx](https://github.com/DeanAyalon/dean-nginx)
**It is recommended to use this repository paired with [dean-nginx](https://github.com/DeanAyalon/dean-nginx) or your own version of [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy)**

After running, use Verdaccio as you would with npm, simply add `--registry=<url>`
> ex. `npm --registry=https://verdaccio.deanayalon.com publish my-package`
Any package not within the registry will be proxied to https://npmjs.com

## Alternate Configuration

### No Proxy
In order to use this repository without a proxy:
- Enable port mapping
- Enable certificate mounting

The configuration file should work as is.
The configuration file should work as is.<br>

#### If it does not work, here are your options:
- Open an [issue](https://github.com/DeanAyalon/verdaccio/issues) and I'll get to it, either fixing the config file, or splitting it into proxy/conf and no-proxy/conf if need be
- Fork, fix and open a PR, I'll review and merge with gratitude!
- Use [v1](#v1) - It was configured to run without a proxy, using https
> The problem with running Verdaccio without proxy is that it caches its html for an hour. This makes the webserver only work for the first url requested.<br>
> Therefore, it is recommended setting the healthcheck interval to 10s and building a new image, so that the correct url will be locked right away.

## v1
v1 of this repository does not use https-proxy, instead exposing port 4873 and setting Verdaccio protocol to HTTPS
> Requires .env variable `$CERTS`
### HTTP - Unchecked
Unsure, but removing the `VERDACCIO_PROTOCOL` environment variable will set it back to the default value: `http`<br>
This may allow for launching the container with neither proxy, nor https encryption.
### HTTP - Unrecommended
Unsure, but opening port 4873 and setting the `VERDACCIO_PROTOCOL` environment variable to `http` may allow for launching the container with neither proxy, nor https encryption.

> THIS IS NOT RECOMMENDED, ALL COMMUNICATION WILL BE UNENCRYPTED, INCLUDING PASSWORDS AND PRIVATE PACKAGES!
> > Regardless, this will be checked for ease of development
> > Regardless, this possibility will be checked for ease of local development


# About me
# About
Hi, I am [Dean Ayalon](https://deanayalon.com), a software developer from Israel.

## Contact Me

## Contact Me!
Feel free to contact me for any reason, including:
- Insturctions, explanations and help
- Code recommendations and feature requests
Expand Down

0 comments on commit 8d80fe7

Please sign in to comment.