Skip to content

Commit

Permalink
Merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
thomiceli committed May 12, 2024
2 parents 748bd83 + 2fd053a commit 235fe5d
Show file tree
Hide file tree
Showing 88 changed files with 3,870 additions and 1,367 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.21
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.21"
go-version: "1.22"

- name: Lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -36,20 +36,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.21
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.21"
go-version: "1.22"

- name: Check
- name: Check Go modules
run: make go_mod check_changes

- name: Check translations
run: make check-tr

test:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
go: ["1.21"]
go: ["1.22"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.21
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.21"
go-version: "1.22"

- name: Cross compile build
run: make all_crosscompile
Expand Down
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
# Changelog

## [1.7.2](https://github.com/thomiceli/opengist/compare/v1.7.1...v1.7.2) - 2024-05-05
See here how to [update](/docs/update.md) Opengist.

### Added
- Docs:
- Run with systemd as a normal user (#254)
- Kubernetes deployment (#258)
- More translation strings (#269) (#271)

### Changed
- Rework git log parsing and truncating (#260)
- Set Opengist version from git tags (#261)

### Fixed
- Missing preview button when editing .md gist (#259)
- Frontend (#267)
- Fix mermaid display
- Move Login/Register buttons on mobile
- Set minimum width on avatar

### Other
- Use go 1.22 and update deps (#244)

## [1.7.1](https://github.com/thomiceli/opengist/compare/v1.7.0...v1.7.1) - 2024-04-05
See here how to [update](/docs/update.md) Opengist.

### Added
- Docs: More detailed variant for custom pages (#248)

### Fixed
- Auth page GitlabName Error (#242)
- Empty invitation on user creation (#247)

## [1.7.0](https://github.com/thomiceli/opengist/compare/v1.6.1...v1.7.0) - 2024-04-03
See here how to [update](/docs/update.md) Opengist.

Note: all sessions will be invalidated after this update.

### Added
- Custom logo configuration (#209)
- Custom static links (#234)
- Invitations for closed registrations (#233)
- Set gist visibility via Git push options (#215)
- Set gist URL and title via push options (#216)
- Specify custom names in the OAuth login buttons (#214)
- Markdown preview (#224)
- Reset a user password using CLI (#226)
- Translations (#207, #210)

### Changed
- Use filesystem session store (#240)
- Move Git hook logic to Opengist (#213)
- Increase login for 1 year (#222)

### Fixed
- Show theme change button on responsive devices (#225)
- New line literal in embed gists (#237)

### Other
- GitHub security updates
- New docker dev env (#220)

## [1.6.1](https://github.com/thomiceli/opengist/compare/v1.6.0...v1.6.1) - 2024-01-06
See here how to [update](/docs/update.md) Opengist.

Expand Down
38 changes: 30 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
FROM alpine:3.19 AS build
FROM alpine:3.19 AS base

RUN apk update && \
apk add --no-cache \
make \
gcc \
musl-dev \
libstdc++
apk add --no-cache \
make \
shadow \
openssl \
openssh \
curl \
wget \
git \
gnupg \
xz \
gcc \
musl-dev \
libstdc++

COPY --from=golang:1.21-alpine /usr/local/go/ /usr/local/go/
COPY --from=golang:1.22-alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"
ENV CGO_ENABLED=0

COPY --from=node:20-alpine /usr/local/ /usr/local/
ENV NODE_PATH="/usr/local/lib/node_modules"
Expand All @@ -18,10 +27,23 @@ WORKDIR /opengist

COPY . .


FROM base AS dev

EXPOSE 6157 2222 16157
VOLUME /opengist

RUN git config --global --add safe.directory /opengist

CMD ["make", "watch"]


FROM base AS build

RUN make


FROM alpine:3.19 as run
FROM alpine:3.19 as prod

RUN apk update && \
apk add --no-cache \
Expand Down
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.PHONY: all all_crosscompile install build_frontend build_backend build build_crosscompile build_docker watch_frontend watch_backend watch clean clean_docker check_changes go_mod fmt test
.PHONY: all all_crosscompile install build_frontend build_backend build build_crosscompile build_docker build_dev_docker run_dev_docker watch_frontend watch_backend watch clean clean_docker check_changes go_mod fmt test check-tr

# Specify the name of your Go binary output
BINARY_NAME := opengist
GIT_TAG := $(shell git describe --tags)
VERSION_PKG := github.com/thomiceli/opengist/internal/config.OpengistVersion

all: clean install build

Expand All @@ -20,7 +22,7 @@ build_frontend:

build_backend:
@echo "Building Opengist binary..."
go build -tags fs_embed -o $(BINARY_NAME) .
go build -tags fs_embed -ldflags "-X $(VERSION_PKG)=$(GIT_TAG)" -o $(BINARY_NAME) .

build: build_frontend build_backend

Expand All @@ -31,16 +33,23 @@ build_docker:
@echo "Building Docker image..."
docker build -t $(BINARY_NAME):latest .

build_dev_docker:
@echo "Building Docker image..."
docker build -t $(BINARY_NAME)-dev:latest --target dev .

run_dev_docker:
docker run -v .:/opengist -p 6157:6157 -p 16157:16157 -v $(HOME)/.opengist-dev:/root/.opengist --rm $(BINARY_NAME)-dev:latest

watch_frontend:
@echo "Building frontend assets..."
npx vite -c public/vite.config.js dev --port 16157
npx vite -c public/vite.config.js dev --port 16157 --host

watch_backend:
@echo "Building Opengist binary..."
OG_DEV=1 npx nodemon --watch '**/*' -e html,yml,go,js --signal SIGTERM --exec 'go run . --config config.yml'
OG_DEV=1 npx nodemon --watch '**/*' -e html,yml,go,js --signal SIGTERM --exec 'go run -ldflags "-X $(VERSION_PKG)=$(GIT_TAG)" . --config config.yml'

watch:
@bash ./scripts/watch.sh
@sh ./scripts/watch.sh

clean:
@echo "Cleaning up build artifacts..."
Expand All @@ -64,3 +73,6 @@ fmt:

test:
@go test ./... -p 1

check-tr:
@bash ./scripts/check-translations.sh
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Opengist is a **self-hosted** pastebin **powered by Git**. All snippets are stor
read and/or modified using standard Git commands, or with the web interface.
It is similiar to [GitHub Gist](https://gist.github.com/), but open-source and could be self-hosted.

[Documentation](/docs)[Demo](https://opengist.thomice.li)
[Documentation](/docs)[Discord](https://discord.gg/9Pm3X5scZT)[Demo](https://demo.opengist.io)


![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/thomiceli/opengist?sort=semver)
Expand Down Expand Up @@ -37,7 +37,7 @@ It is similiar to [GitHub Gist](https://gist.github.com/), but open-source and c
Docker [images](https://github.com/thomiceli/opengist/pkgs/container/opengist) are available for each release :

```shell
docker pull ghcr.io/thomiceli/opengist:1
docker pull ghcr.io/thomiceli/opengist:1.7
```

It can be used in a `docker-compose.yml` file :
Expand All @@ -51,7 +51,7 @@ version: "3"

services:
opengist:
image: ghcr.io/thomiceli/opengist:1
image: ghcr.io/thomiceli/opengist:1.7
container_name: opengist
restart: unless-stopped
ports:
Expand All @@ -78,9 +78,9 @@ Download the archive for your system from the release page [here](https://github

```shell
# example for linux amd64
wget https://github.com/thomiceli/opengist/releases/download/v1.6.1/opengist1.6.1-linux-amd64.tar.gz
wget https://github.com/thomiceli/opengist/releases/download/v1.7.2/opengist1.7.2-linux-amd64.tar.gz
tar xzvf opengist1.6.1-linux-amd64.tar.gz
tar xzvf opengist1.7.2-linux-amd64.tar.gz
cd opengist
chmod +x opengist
./opengist # with or without `--config config.yml`
Expand All @@ -90,7 +90,7 @@ Opengist is now running on port 6157, you can browse http://localhost:6157

### From source

Requirements : [Git](https://git-scm.com/downloads) (2.28+), [Go](https://go.dev/doc/install) (1.21+), [Node.js](https://nodejs.org/en/download/) (16+)
Requirements: [Git](https://git-scm.com/downloads) (2.28+), [Go](https://go.dev/doc/install) (1.22+), [Node.js](https://nodejs.org/en/download/) (16+), [Make](https://linux.die.net/man/1/make) (optional, but easier)

```shell
git clone https://github.com/thomiceli/opengist
Expand All @@ -101,6 +101,9 @@ make

Opengist is now running on port 6157, you can browse http://localhost:6157

---

To create and run a development environment, see [run-development.md](/docs/contributing/run-development.md).

## Documentation

Expand Down
18 changes: 18 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,33 @@ gitlab.client-key:
gitlab.secret:
# URL of the Gitlab instance. Default: https://gitlab.com/
gitlab.url: https://gitlab.com/
# The name of the GitLab instance. It is displayed in the OAuth login button. Default: GitLab
gitlab.name: GitLab

# To create a new OAuth2 application using Gitea : https://gitea.domain/user/settings/applications
gitea.client-key:
gitea.secret:
# URL of the Gitea instance. Default: https://gitea.com/
gitea.url: https://gitea.com/
# The name of the Gitea instance. It is displayed in the OAuth login button. Default: Gitea
gitea.name: Gitea

# To create a new OAuth2 application using OpenID Connect:
oidc.client-key:
oidc.secret:
# Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration
oidc.discovery-url:


# Custom assets
# Add your own custom assets, that are files relatives to $opengist-home/custom/
custom.logo:
custom.favicon:

# Static pages in footer (like legal notices, privacy policy, etc.)
# The path can be a URL or a relative path to a file in the $opengist-home/custom/ directory
custom.static-links:
# - name: Gitea
# path: https://gitea.com
# - name: Legal notices
# path: legal.html
Loading

0 comments on commit 235fe5d

Please sign in to comment.