45 Commits

Author SHA1 Message Date
b724f4e51c Merge branches 'ci-build-images', 'bug-cannot-autogenerate-self_signed-keys' and 'bug-cannot-start-container' into alt-master 2021-01-01 16:35:03 +01:00
a7c097d232 fix: auto-generate keys when --yes is passed
Probably a typo in the if condition as the same commit uses the correct condition elsewhere.
Only if --yes isn't passed should the user be queried interactively
2021-01-01 16:21:56 +01:00
7282cb5fa0 fix: Use correct command name in entrypoint.sh
The generated executable isn't called i2p-tools-1 but reseed-tools.
Without the correct name, the container wouldn't start.
2021-01-01 16:18:33 +01:00
2f8508ee92 ci: Use multiline chomp in YAML
It put the backslashes right into the bash command bash didn't really like that.
Bash escaped spaces and that lead to a bad command
2020-12-29 16:21:29 +01:00
b036b9e8f8 ci: Quote variables properly 2020-12-29 10:47:08 +01:00
f36a500210 ci: Improve tag regex for pushing docker 2020-12-29 10:34:29 +01:00
dbcf640320 ci: Push README to dockerhub 2020-12-29 10:26:48 +01:00
08f2f9031d Add more comments to .gitlab-ci.yml 2020-12-29 01:07:27 +01:00
d40d687f6e ci: limit builds to tags with certain names 2020-12-29 01:05:21 +01:00
b12bf1bf22 docker: ignore IDE files 2020-12-29 00:55:38 +01:00
7bcc9344ec Use correct syntax to ignore folders for docker 2020-12-29 00:54:23 +01:00
f84eb3ce70 retrigger dockerhub build 2020-12-29 00:52:45 +01:00
f576588ec0 Trigger dockerhub build 2020-12-29 00:51:22 +01:00
0ae229792c Ignore .git in docker image 2020-12-29 00:45:16 +01:00
4e69e3d50b Try dockerhub again
There were protected variables involved...
2020-12-29 00:41:53 +01:00
059a24d638 Try to force dockerhub push 2020-12-29 00:30:52 +01:00
45071f0faa Add comments to registry jobs 2020-12-29 00:19:19 +01:00
0791f1145b Don't rebuild image for docker push 2020-12-29 00:15:10 +01:00
51c58d6407 Ninja commit to push new version to dockerhub 2020-12-29 00:01:39 +01:00
0bf519a351 dockerhub build cache from CI_REGISTRY_IMAGE 2020-12-28 23:36:38 +01:00
1eb8e6fb5c Make sure all variables are set before registry push 2020-12-28 23:28:30 +01:00
c4b8236446 Add .gitlab-ci.yml to docker ignore 2020-12-28 22:44:53 +01:00
162c6fb01a Make sure push_docker job only pulls cache
It won't rebuild the image. All it does is push it
2020-12-28 22:35:53 +01:00
11c6b51be6 Ignore and rename CI docker image cache folder from docker build
Images would otherwise include cached docker images
2020-12-28 19:41:13 +01:00
17712bf3ae Try to fix the docker load command
Input needs to come from STDIN
2020-12-28 19:30:46 +01:00
7a438a29ed Create the exports directory to save images 2020-12-28 19:21:34 +01:00
b0cd962ce9 Try using cache instead of local registry
We don't need a server and can just attempt to save the image to later load it.
2020-12-28 19:15:45 +01:00
92462d8986 Name registry in dind and make sure it's running 2020-12-28 18:39:44 +01:00
8d1a4408ce Remove attempt to curl 2020-12-28 18:34:07 +01:00
179688d8c0 Remove dig dep 2020-12-28 18:27:49 +01:00
cb674587f6 Attempt to contact registry service on dind 2020-12-28 18:23:41 +01:00
dc0ec87635 Try using a registry in dind 2020-12-28 18:21:03 +01:00
4c86b4fd8a Hope the dind daemon can connect to the registry... 2020-12-28 17:56:23 +01:00
d48d8e217d Remove docker ps commands 2020-12-28 17:44:44 +01:00
0ac1d8ad65 Try to contact localhost:5000 instead of registry
Hopefully it will have been exposed there (doubtful)
2020-12-28 17:41:05 +01:00
c46fcb14f7 Add correct registry to list of insecure registries 2020-12-28 16:10:47 +01:00
3ec7aace8a Use correct registry name 2020-12-28 16:08:04 +01:00
07b65bee1f Test local registry availability before starting job 2020-12-28 16:07:33 +01:00
1589518259 Re-enable TLS and try to mark local registry as insecure 2020-12-28 16:00:42 +01:00
9fe7931202 Disable TLS to try and make local registry work 2020-12-28 15:45:57 +01:00
8daf43276b Separate docker jobs 2020-12-28 15:39:05 +01:00
2173a6a36e Try and rename local registry image
docker doesn't like "registry:5000:commit_sha" as a tag
2020-12-28 15:32:37 +01:00
f9c992dcb2 Try caching images in a local registry before pushing 2020-12-28 15:27:20 +01:00
fd9eae23eb Build docker images with gitlab CI
These will be pushed to gitlab's CI by default, but can be configured to push to another registry e.g docker hub.
2020-12-28 15:02:04 +01:00
idk
53eeba13a8 use the i2pgit.org module 2020-12-24 10:41:16 -05:00
14 changed files with 135 additions and 21 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
.idea
.git
.gitlab-ci.yml
.vscode
# CI cache folder storing docker images
ci-exports

106
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,106 @@
image: docker:19.03.12
stages:
- docker_test
- docker_push
variables:
# When using dind service, we need to instruct docker to talk with
# the daemon started inside of the service. The daemon is available
# with a network connection instead of the default
# /var/run/docker.sock socket. Docker 19.03 does this automatically
# by setting the DOCKER_HOST in
# https://github.com/docker-library/docker/blob/d45051476babc297257df490d22cbd806f1b11e4/19.03/docker-entrypoint.sh#L23-L29
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
#
# Specify to Docker where to create the certificates, Docker will
# create them automatically on boot, and will create
# `/certs/client` that will be shared between the service and job
# container, thanks to volume mount from config.toml
DOCKER_TLS_CERTDIR: "/certs"
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
DOCKER_HOST: tcp://docker:2376
services:
- docker:19.03.12-dind
.docker_cache:
cache:
# The same key should be used across branches
key: "$CI_COMMIT_REF_SLUG"
paths:
- ci-exports/*.tar
# Make sure we can build a docker image
# It's cached for later jobs
build_docker:
extends:
- .docker_cache
stage: docker_test
script:
# Try to load latest branch image from local tar or from registry
- docker load ci-exports/$CI_COMMIT_REF_SLUG.tar || docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:latest .
- mkdir -p ci-exports/
- docker save $CI_REGISTRY_IMAGE:latest > ci-exports/$CI_COMMIT_REF_SLUG.tar
# Publishes the configured CI registry (by default that's gitlab's registry)
push_ci_registry:
extends:
- .docker_cache
stage: docker_push
cache:
policy: pull
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- cat ci-exports/$CI_COMMIT_REF_SLUG.tar | docker load
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE:latest
only:
refs:
# Make sure to protect these tags!
- /^v(\d+\.){2,3}\d+$/
- /.+-release$/
variables:
- $CI_REGISTRY
- $CI_REGISTRY_USER
- $CI_REGISTRY_PASSWORD
- $CI_REGISTRY_IMAGE
# Publishes the cached image to docker
push_dockerhub_registry:
extends:
- .docker_cache
stage: docker_push
cache:
policy: pull
before_script:
- docker login -u $DOCKERHUB_REGISTRY_USER -p $DOCKERHUB_REGISTRY_PASSWORD $DOCKERHUB_REGISTRY
script:
- cat ci-exports/$CI_COMMIT_REF_SLUG.tar | docker load
- docker tag $CI_REGISTRY_IMAGE:latest $DOCKERHUB_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker tag $CI_REGISTRY_IMAGE:latest $DOCKERHUB_REGISTRY_IMAGE:latest
- docker push $DOCKERHUB_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker push $DOCKERHUB_REGISTRY_IMAGE:latest
# Push the readme to dockerhub
- >-
docker run -v $PWD:/workspace
-e DOCKERHUB_USERNAME="$DOCKERHUB_REGISTRY_USER"
-e DOCKERHUB_PASSWORD="$DOCKERHUB_REGISTRY_PASSWORD"
-e DOCKERHUB_REPOSITORY="$DOCKERHUB_REGISTRY_IMAGE"
-e README_FILEPATH='/workspace/README.md'
peterevans/dockerhub-description:2
only:
refs:
# Make sure to protect these tags!
- /^v(\d+\.){2,3}\d+$/
- /.+-release$/
variables:
- $DOCKERHUB_REGISTRY
- $DOCKERHUB_REGISTRY_USER
- $DOCKERHUB_REGISTRY_PASSWORD
- $DOCKERHUB_REGISTRY_IMAGE

View File

@@ -31,4 +31,4 @@
* numRi per su3 file: 75 --> 77
2016-01
* fork from https://github.com/idk/reseed-tools
* fork from https://i2pgit.org/idk/reseed-tools

View File

@@ -1,8 +1,8 @@
FROM debian:stable-backports
ARG I2P_GID=1000
ARG I2P_UID=1000
COPY . /var/lib/i2p/go/src/github.com/idk/reseed-tools
WORKDIR /var/lib/i2p/go/src/github.com/idk/reseed-tools
COPY . /var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools
WORKDIR /var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y git golang-1.13-go make && \
@@ -11,4 +11,4 @@ RUN apt-get update && \
RUN /usr/lib/go-1.13/bin/go build -v -tags netgo -ldflags '-w -extldflags "-static"'
USER $I2P_UID
WORKDIR /var/lib/i2p/i2p-config/reseed
ENTRYPOINT [ "/var/lib/i2p/go/src/github.com/idk/reseed-tools/entrypoint.sh" ]
ENTRYPOINT [ "/var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools/entrypoint.sh" ]

View File

@@ -9,7 +9,7 @@ create, sign, and validate SU3 files. Please note that this requires at least Go
If you have go installed you can download, build, and install this tool with `go get`
```
go get github.com/idk/reseed-tools
go get i2pgit.org/idk/reseed-tools
i2p-tools -h
```
@@ -102,7 +102,7 @@ also a short guide and complete tech info.
Requires ```go mod``` and at least go 1.13. To build the idk/reseed-tools
fork, from anywhere:
git clone https://github.com/idk/reseed-tools
git clone https://i2pgit.org/idk/reseed-tools
cd i2p-tools-1
make build

View File

@@ -18,10 +18,10 @@ import (
"github.com/cretz/bine/torutil/ed25519"
"github.com/eyedeekay/sam3"
"github.com/eyedeekay/sam3/i2pkeys"
"github.com/idk/reseed-tools/reseed"
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/host"
"github.com/urfave/cli"
"i2pgit.org/idk/reseed-tools/reseed"
)
func NewReseedCommand() cli.Command {

View File

@@ -16,8 +16,8 @@ import (
"strings"
"time"
"github.com/idk/reseed-tools/reseed"
"github.com/idk/reseed-tools/su3"
"i2pgit.org/idk/reseed-tools/reseed"
"i2pgit.org/idk/reseed-tools/su3"
)
func loadPrivateKey(path string) (*rsa.PrivateKey, error) {
@@ -71,7 +71,7 @@ func checkOrNewTLSCert(tlsHost string, tlsCert, tlsKey *string, auto bool) error
fmt.Printf("Unable to read TLS key '%s'\n", *tlsKey)
}
if auto {
if !auto {
fmt.Printf("Would you like to generate a new self-signed certificate for '%s'? (y or n): ", tlsHost)
reader := bufio.NewReader(os.Stdin)
input, _ := reader.ReadString('\n')

View File

@@ -4,9 +4,9 @@ import (
"fmt"
"io/ioutil"
"github.com/idk/reseed-tools/reseed"
"github.com/idk/reseed-tools/su3"
"github.com/urfave/cli"
"i2pgit.org/idk/reseed-tools/reseed"
"i2pgit.org/idk/reseed-tools/su3"
)
func NewSu3VerifyCommand() cli.Command {

View File

@@ -1,5 +1,5 @@
#! /usr/bin/env sh
cp -r /var/lib/i2p/go/src/github.com/idk/reseed-tools/content ./content
cp -r /var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools/content ./content
/var/lib/i2p/go/src/github.com/idk/reseed-tools/i2p-tools-1 reseed --yes=true --netdb=/var/lib/i2p/i2p-config/netDb $@
/var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools/reseed-tools reseed --yes=true --netdb=/var/lib/i2p/i2p-config/netDb $@

2
go.sum
View File

@@ -66,7 +66,7 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/idk/reseed-tools v0.0.4/go.mod h1:l36HvPTtSxbLHelUNo/GQ7+wYbi+oEL2xv/XJnj8aS0=
i2pgit.org/idk/reseed-tools v0.0.4/go.mod h1:l36HvPTtSxbLHelUNo/GQ7+wYbi+oEL2xv/XJnj8aS0=
github.com/eyedeekay/ramp v0.0.0-20190429201811-305b382042ab h1:EfTRHxGSbiaEyxNzvKRBWVIDw3mD8xXGxj4gvwFzY7Q=
github.com/eyedeekay/ramp v0.0.0-20190429201811-305b382042ab/go.mod h1:h7mvUAMgZ/rtRDUOkvKTK+8LnDMeUhJSoa5EPdB51fc=
github.com/eyedeekay/sam3 v0.32.2 h1:xODDY5nBVg0oK7KaYk7ofkXFoHPsmI1umhSv1TZlS7s=

View File

@@ -41,4 +41,4 @@
* numRi per su3 file: 75 --> 77
2016-01
* fork from https://github.com/idk/reseed-tools
* fork from https://i2pgit.org/idk/reseed-tools

View File

@@ -4,8 +4,8 @@ import (
"os"
"runtime"
"github.com/idk/reseed-tools/cmd"
"github.com/urfave/cli"
"i2pgit.org/idk/reseed-tools/cmd"
)
func main() {

View File

@@ -84,7 +84,7 @@ func HandleAFile(w http.ResponseWriter, dirPath, file string) {
path := filepath.Join(BaseContentPath, file)
f, err := ioutil.ReadFile(path)
if err != nil {
w.Write([]byte("Oops! Something went wrong handling your language. Please file a bug at https://github.com/idk/reseed-tools\n\t" + err.Error()))
w.Write([]byte("Oops! Something went wrong handling your language. Please file a bug at https://i2pgit.org/idk/reseed-tools\n\t" + err.Error()))
return
}
CachedDataPages[file] = f
@@ -99,7 +99,7 @@ func HandleALocalizedFile(w http.ResponseWriter, dirPath string) {
dir := filepath.Join(BaseContentPath, "lang", dirPath)
files, err := ioutil.ReadDir(dir)
if err != nil {
w.Write([]byte("Oops! Something went wrong handling your language. Please file a bug at https://github.com/idk/reseed-tools\n\t" + err.Error()))
w.Write([]byte("Oops! Something went wrong handling your language. Please file a bug at https://i2pgit.org/idk/reseed-tools\n\t" + err.Error()))
}
var f []byte
for _, file := range files {
@@ -110,7 +110,7 @@ func HandleALocalizedFile(w http.ResponseWriter, dirPath string) {
path := filepath.Join(dir, file.Name())
b, err := ioutil.ReadFile(path)
if err != nil {
w.Write([]byte("Oops! Something went wrong handling your language. Please file a bug at https://github.com/idk/reseed-tools\n\t" + err.Error()))
w.Write([]byte("Oops! Something went wrong handling your language. Please file a bug at https://i2pgit.org/idk/reseed-tools\n\t" + err.Error()))
return
}
f = append(f, []byte(`<div id="`+trimmedName+`">`)...)

View File

@@ -15,7 +15,7 @@ import (
"sync"
"time"
"github.com/idk/reseed-tools/su3"
"i2pgit.org/idk/reseed-tools/su3"
)
type routerInfo struct {