-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c9ad1b5
Showing
9 changed files
with
1,487 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 80 | ||
|
||
[*.md] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Deliver Application | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
workflow_run: | ||
types: | ||
- completed | ||
workflows: | ||
- Check Linter Errors | ||
|
||
jobs: | ||
create-release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') | ||
strategy: | ||
matrix: | ||
node-version: [ 20.x ] | ||
pnpm-version: [ 8.x ] | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: mkdir build | ||
- run: mv src/ build | ||
- name: Zip application | ||
uses: vimtor/action-zip@v1.1 | ||
with: | ||
dest: letsencrypt-acme-challenge-server-${{ github.ref_name }}.zip | ||
files: build package.json package-lock.yaml | ||
- name: Release application | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: Version ${{ github.ref_name }} of the application | ||
body_path: ./CHANGELOG.md | ||
files: | | ||
letsencrypt-acme-challenge-server-${{ github.ref_name }}.zip | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true | ||
draft: false | ||
prerelease: false | ||
|
||
push-docker-image: | ||
name: Push Docker Image | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') | ||
strategy: | ||
matrix: | ||
docker-repository: [ juansecu/letsencrypt-acme-challenge-server ] | ||
platforms: | ||
- linux/amd64 | ||
- linux/arm64 | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Log in to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
- name: Build and push the Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: ${{ matrix.platforms }} | ||
push: true | ||
tags: ${{ matrix.docker-repository }}:${{ github.ref_name }},${{ matrix.docker-repository }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Dependency directories | ||
node_modules/ | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# Editor directories and files | ||
.idea/ | ||
.vscode/ | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Serverless directories | ||
.serverless/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM node:20-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json ./ | ||
COPY src ./src | ||
|
||
RUN chown -R node /app | ||
USER node | ||
|
||
RUN npm install --production | ||
|
||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# Let's Encrypt ACME Challenge Server | ||
|
||
This is a simple server that can be used | ||
to serve ACME challenge requests for Let's Encrypt. | ||
|
||
## Requirements | ||
|
||
- **Node.js -** Version 20 | ||
- **Environment variables:** | ||
|
||
- `LETSENCRYPT_CHALLENGE` - The challenge string that Let's Encrypt will request. | ||
|
||
## Running | ||
|
||
### Using Docker (Recommended) | ||
|
||
In order to run the application using [Docker](https://www.docker.com/), | ||
you must have Docker installed on your machine. | ||
|
||
For running the application with Docker, | ||
you will need to map port `80` to your host machine. | ||
|
||
#### Docker CLI | ||
|
||
- **Windows** | ||
|
||
```shell | ||
> docker run -dp 8080:8080 \ | ||
-e LETSENCRYPT_CHALLENGE="<Let's Encrypt challenge string>" \ | ||
--name <container-name> \ | ||
juansecu/letsencrypt-acme-challenge-server:v<version number> | ||
``` | ||
|
||
- **MacOS/Linux** | ||
|
||
```shell | ||
$ docker run -dp 8080:8080 \ | ||
-e LETSENCRYPT_CHALLENGE="<Let's Encrypt challenge string>" \ | ||
--name <container-name> \ | ||
juansecu/letsencrypt-acme-challenge-server:v<version number> | ||
``` | ||
|
||
#### Docker Compose | ||
|
||
For running the application with Docker Compose, you can use | ||
the [Docker Compose file](https://github.com/Juansecu/letsencrypt-acme-challenge-server/blob/main/docker-compose.yml) | ||
provided in this repository for development and production, | ||
but for production, you will also need to | ||
remove the `build` property from the `http-server` service, | ||
change the `image` property to `juansecu/letsencrypt-acme-challenge-server:v<version number>`. | ||
|
||
You can run the application using the following command: | ||
|
||
- **Docker Compose v1** | ||
|
||
```shell | ||
$ docker-compose up -d | ||
``` | ||
|
||
- **Docker Compose v2** | ||
|
||
```shell | ||
$ docker compose up -d | ||
``` | ||
|
||
### Using Node.js | ||
|
||
For running the application with Node.js, | ||
you will need to set the necessary environment variables | ||
and follow the instructions below. | ||
|
||
#### For Development | ||
|
||
In order to run the application for development, | ||
you will need to clone this repository | ||
and run it using the following commands: | ||
|
||
- **Windows** | ||
|
||
```shell | ||
# --- INSTALLING DEPENDENCIES --- | ||
> npm install | ||
# --- RUNNING --- | ||
> npm run dev | ||
``` | ||
|
||
- **MacOS/Linux** | ||
|
||
```shell | ||
# --- INSTALLING DEPENDENCIES --- | ||
$ npm install | ||
# --- RUNNING --- | ||
$ npm run dev | ||
``` | ||
|
||
#### For Production | ||
|
||
In order to run the application for production, | ||
you will only need to download the latest release | ||
from the [releases page](https://github.com/Juansecu/letsencrypt-acme-challenge-server/releases), | ||
set the necessary environment variables | ||
and run the application using the following commands: | ||
|
||
- **Windows** | ||
|
||
```shell | ||
# --- INSTALLING DEPENDENCIES --- | ||
> npm install --production | ||
# --- RUNNING --- | ||
> npm start | ||
``` | ||
|
||
- **MacOS/Linux** | ||
|
||
```shell | ||
# --- INSTALLING DEPENDENCIES --- | ||
$ npm install --production | ||
# --- RUNNING --- | ||
$ npm start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.9' | ||
|
||
services: | ||
http-server: | ||
image: letsencrypt-acme-challenge-server | ||
container_name: letsencrypt-acme-challenge-server | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
environment: | ||
LETSENCRYPT_CHALLENGE: ${LETSENCRYPT_CHALLENGE} | ||
ports: | ||
- '80:80' |
Oops, something went wrong.