Skip to content

Commit

Permalink
DPS 3 - Beta (#286)
Browse files Browse the repository at this point in the history
* Setup gradle initial project

* Gradle simple setup

* Setup patch version wildcards

* will continue later

* migrating plugin

* setup dnsjava lib

* Basic client server conversation

* Simple remote server proxy

* Native image working

* Dagger initial setup

* Add some writer threads to udp server

* creating wildcard builder

* working on docker solver

* configuring docker solver

* adjustments

* Fixing ip parse

* docker client dep

* Created real docker client solver

* refactoring

* getting ip from bridge network

* Fixing hostname matching from env

* configuring docker client package

* Setup docker java client reflection

* Fixing spearator

* adjusting reflection

* adjusting reflection

* More reflection stuff

* Adjusting

* Native image log fixed

* removing unnecessary files

* refactoring packages

* unused class

* fixing javadoc

* unifiying

* quarkus working

* add instructions

* Settings

* Setup solvers

* Setup missing beans

* Json config contract

* fixing readme

* clearing gradle

* deleting dagger files

* flags structure

* Setup jcommander dependency

* some docs

* Before pico cli refactoring

* Setup pico cli

* testing flagts

* Some tests created

* Fixing help formatting

* Testing the version

* Setup version get

* setup help

* refactoring

* Setup configs

* Simplifying

* Refactoring

* javadoc

* Mapping json and env configs

* Mapped configs

* Test is passing

* Adjusting tests

* More tests

* Fixing tests

* Customizing http server port

* configuring log level

* Keep going

* All configs matched

* Implementing and test config json v1

* formatting

* Fixing test

* Fixing test

* Fixing quarkus startup for testing

* otimization

* DPS 3 - System Solver (#271)

* System solver is done

* Fixing bean injection

* Solver working

* Testing

* Configuring native image to work again

* fixing docker java jna stuff

* Adjusting graalvm reflection config

* missing docker java reflection config

* Creating test for solver system native image

* Fixing intermitent test

* fixing tests

* Fixing test

* Fixing native test

* New method

* back to the old and good reflect.json generated by 'reflection-config-generator'

* DPS 3 -  Remote solver complete (#272)

* Setup remote servers config

* Testing default dns servers

* Fixing tests

* Fixing test

* Fixing tests

* Fixing test

* Fixing tests

* Fixing tests

* Fixing all tests

* Set default timeout

* Some fixes

* Adjusting version

* DPS 3 - Local DB Solver (#273)

* configuring image heap

* Configuring env hostnames retrieve

* Testing default id generator

* Ajusting logs

* ServerLocal is working

* Fixing test

* Fixing test

* Test is not completed

* did a lot of changes to fix the test

* Fixing the test

* Fixing test

* More tests

* Fixing more tests

* Fixing test

* Fixing one more test

* Fixing one more test

* fixing tests

* Refactoring

* Clean code

* DPS 3 - Docker networks (#274)

* DPS network draft code

* adjustments

* Connect running containers to dps network at startup

* adjustments

* Fixing  containers attach check

* Solve from label, dps, bridge, then default

* logs adjustment

* Refactoring

* checkstyle

* DPS 3 - Docker Register Service Names (#275)

* removing already done todos

* Implementing

* refactoring

* refactoring

* Testing

* Testing

* Fixing intermitent test

* Configuring reflection

* Must change log level just for mageddo package

* Fixing bug

* Fixing bug

* checking docker is connected (#276)

* Fixing tests (#277)

* created active env api

* Ignoring  static folder

* DPS 3 - GUI REST API (#278)

* New apis created

* new rest apis

* Fixing gui api filling

* Update api

* Remove hostnane endpoint api

* Refactoring

* Fixing apis

* Updating copyright

* Updating developing instructions

* Reverting test

* DPS - 3 LocalDB Solver CNAME Support (#279)

* Cname support

* Testing and fixing tests

* Fixing tests

* Fixing cname solving

* Fixing tests

* adjusts

* adjusts

* adjusts

* DPS 3 - Auto Configure (#280)

* Linux default configurator is workign

* testing

* Restore config

* Ajusts

* adjusts

* Todos

* Resverting dep

* Fixing tests

* Fixing tests

* Fixing tests

* DPS - 3 DNS Resolution Hangs Fixes (#281)

* Setup solver caching

* handling erors

* Ajusting copy

* Must clone record before merge them

* Ajusting

* Adjusting message building

* Caching no results for 10 seconds

* Leading with concurrency

* adjusting address binding

* adjusting version

* DPS 3 -  Minimal debug log (#282)

* Reducing the logs

* Adjusting logh

* Fixing compiling errors

* deleting v2 files (#283)

* Deleting

* DPS 3 - CI/CD (#284)

* Add doc

* ci

* ci

* ci

* Adjusting test

* Adjusting test

* Adjusting jarname

* some frustated tries

* Create config dir if dont exists

* checkpoint

* Refactoring docker connection check

* Unnecessary code

* Adjusting reflection config

* Deleting unused file

* need to scan whole package

* Trying to fix jna

* Probably fixing jna

* Fixing docker build

* Trying to fix library reflection

* Fixing reference

* Fixing reference

* old libc compatibility

* cleanup

* Refactoring

* Cd is probably ready

* some fixes

* Adjusting

* Ajusting CD

* Cleanup

* Ajusting CD

* Ajusting CD

* Ajusting CD

* Ajusting service name

* Setup logs

* adjusts

* Adjusting

* Release notes

* Bump version

* Adjusting deploy

* Adjusting deploy

* new try

* new try

* new try

* Fully working

* Adjusting envs

* Migrating image

* Migrating image

* Fixing

* Clearing and specify version

* bump

* bump version

* Adjustments

* Adjustments

* Adjustments

* Fixing home page

* adjusting

* new version

* docs deploy workflow

* fixing command

* adjustments

* upgrading

* fixing branch

* bump

* update

* configuring version

* forcing checkout

* fixing latest version

* Generate on tags not pull requests

* fixing command

* fixing broken symbolic link because of gradle

* fixing cd

* gracefull exit

* run cd only on master

* cancel previous job

* byump
  • Loading branch information
mageddo authored Feb 20, 2023
1 parent 9109040 commit 1742a9d
Show file tree
Hide file tree
Showing 643 changed files with 10,806 additions and 185,958 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
**/node_modules
build
#*
#!build/*-runner
#!build/*-runner.jar
#!build/lib/*
#!build/quarkus-app/*
8 changes: 0 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,5 @@ root = true
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 2

[*.yml]
indent_style = space

[app/*package.json]
indent_style = space
indent_size = 2

34 changes: 3 additions & 31 deletions .github/workflows/actions-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,9 @@ jobs:
fetch-depth: '0'

- name: Deploy
run: ./builder.bash deploy-ci
run: docker-compose -f docker-compose-deploy.yml up --force-recreate --exit-code-from deploy deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# github token to deploy the binary
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

- name: Docs Generate
id: docs_generate
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.91.2'
- name: Build docs
run: |
./builder.bash docs /tmp/build &&\
echo "VERSION=$(cat VERSION | awk -F '.' '{ print $1"."$2}')" >> "${GITHUB_OUTPUT}"
- name: Docs Deploy - Latest
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/docs/latest
destination_dir: latest
keep_files: true
commit_message: Releasing the docs for latest

- name: Docs Deploy - Minor
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: './build/docs/${{ steps.docs_generate.outputs.VERSION }}'
destination_dir: '${{ steps.docs_generate.outputs.VERSION }}'
keep_files: true
commit_message: 'Releasing the docs: ${{ steps.docs_generate.outputs.VERSION }}'

20 changes: 13 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ name: CI
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Explain
run: |
echo "This workflow will run the basic tests on pull requests, merges into master and all tags."
- name: Checkout code
uses: actions/checkout@v3
- name: Run tests
run: docker-compose rm -f && docker-compose up --build tests
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'adopt'
- name: Build and Tests
run: ./gradlew build test -i

28 changes: 28 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docs

on:
push:
tags:
- '*'

permissions:
contents: write

env:
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}

jobs:
docs-update:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Docs Update
run: docker-compose -f docker-compose-deploy.yml run --rm deploy /bin/builder.bash deploy-docs
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
static
/pkg
/bin
build
out/
.idea/
*.iml
/files
Expand Down Expand Up @@ -30,3 +32,4 @@ coverage
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.lock
74 changes: 74 additions & 0 deletions DRAFT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

## Build project

Binary using Native Image
```bash
$ ./gradlew build -Dquarkus.package.type=native &&\
./build/dns-proxy-server-*-runner --server-port 8053
```

CD
```
docker-compose build build-frontend
```


## Generate binaries
```
native-image -H:+ReportExceptionStackTraces -H:Class=com.mageddo.dnsproxyserver.App build/dns-proxy-server-3.0.0-alpha.jar
```
libfreetype-dev
sudo apt-get install build-essential



# Drafts

## Run a container for testing

```
docker run --rm -it --hostname nginx.dev -e 'HOSTNAMES=nginx.com.br' nginx:1.15 bash
```
## x
```bash
docker-compose -f docker-compose-alpha.yml rm &&\
docker-compose -f docker-compose-alpha.yml build &&\
docker-compose -f docker-compose-alpha.yml run -T --rm arm7x86
```

Generate json reflect for all project

```
$ ./gradlew shadowJar
$ mkdir reflect &&\
$JAVA_HOME/bin/java -agentlib:native-image-agent=config-output-dir=./reflect -jar build/libs/dns-proxy-server*all.jar
/home/typer/Downloads/dns-proxy-server-linux-amd64-2.19.5/dns-proxy-server -default-dns=false -server-port=5481 -web-server-port=5381
--conf-path /tmp/xpto.json
```


```
nslookup -po=8053 google.com 127.0.0.1
-Djava.net.preferIPv4Stack=true
docker network create -d bridge shibata
com.github.dockerjava.core.command.ConnectToNetworkCmdImpl
```

Configurar reflection de classes third party
```
./gradlew build -Dquarkus.package.type=uber-jar
java -cp './build/dns-proxy-server-3.0.0-alpha-runner.jar:../annotation-processing-tools/reflection-config-generator/build/libs/reflection-config-generator-2.4.3-all.jar' nativeimage.core.thirdparty.Main 'com.github.dockerjava.core.command' tmp.json
```


docker-compose -f docker-compose-tmp.yml up --build


13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
FROM docker.io/defreitas/tools_graalvm-22.3_java-19_debian-9:0.1.1 AS BUILDER
COPY ./ /app
WORKDIR /app
RUN ./gradlew clean build -Dquarkus.package.type=native -i &&\
cd build &&\
ls -lha &&\
mkdir -p artifacts &&\
mv $(ls -p ./ | grep -v / | grep dns-proxy-server) ./artifacts/

FROM debian:10-slim
ADD build/dns-proxy-server-linux-amd64*.tgz /app/
COPY --from=BUILDER /app/build/artifacts/* /app/dns-proxy-server
WORKDIR /app
LABEL dps.container=true
VOLUME ["/var/run/docker.sock", "/var/run/docker.sock"]
CMD ["bash", "-c", "/app/dns-proxy-server"]
ENTRYPOINT "/app/dns-proxy-server"
5 changes: 5 additions & 0 deletions Dockerfile.arm7x86.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM arm32v7/debian:10-slim
COPY ./ /building
WORKDIR /building
RUN ./gradlew build nativeImage
ENTRYPOINT "/bin/sh"
19 changes: 0 additions & 19 deletions Dockerfile.builder

This file was deleted.

11 changes: 11 additions & 0 deletions Dockerfile.builder.frontend
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:12-alpine AS FRONTEND
COPY app /app
WORKDIR /app
ENV PUBLIC_URL=/static
RUN npm install &&\
npm run build &&\
rm -f `find ./build -name *.map`

FROM scratch AS ARTIFACTS
COPY --from=FRONTEND /app/build /static
ENTRYPOINT cat
4 changes: 4 additions & 0 deletions Dockerfile.deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM docker.io/defreitas/tools-generic-cd:0.2.1
COPY . /app
COPY ./builder.bash /bin/builder.bash
WORKDIR /app
7 changes: 0 additions & 7 deletions Dockerfile.go.builder

This file was deleted.

6 changes: 6 additions & 0 deletions Dockerfile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM openjdk:17-slim
COPY ./build/dns-proxy-server-*-alpha-runner.jar /app/dns-proxy-server.jar
COPY conf/ /app/conf/
RUN #mkdir /app/conf
WORKDIR /app
ENTRYPOINT ["java", "-jar", "/app/dns-proxy-server.jar", "--log-level", "DEBUG"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ PING dns.mageddo (172.17.0.4) 56(84) bytes of data.
* [Running it documentation](http://mageddo.github.io/dns-proxy-server/latest/en/1-getting-started/running-it/)
* [Examples](https://github.com/mageddo/dns-proxy-server/tree/master/examples)
* [Coding at the DPS](http://mageddo.github.io/dns-proxy-server/latest/en/5-developing/)
* [RFC1035][1]

### Donation
Help me to keep DPS up to date
Expand All @@ -52,3 +53,5 @@ Via PayPal
Or via QR code

![](https://i.imgur.com/LmN7g2j.png)

[1]: https://www.ietf.org/rfc/rfc1035.txt
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.0.1-beta
* DPS has your code totally refactored by maintaining the previous features, it's a structuring for new features
See details at [DNS Proxy Server 3 #267](https://github.com/mageddo/dns-proxy-server/issues/267)

### 2.19.0
* Support for absolute paths on config files (#188)

Expand Down
3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"not ie <= 11",
"not op_mini all"
],
"proxy": "http://compiler-dps:5380"
"proxy": "http://localhost:5380",
"proxy_": "http://compiler-dps:5380"
}
2 changes: 1 addition & 1 deletion app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<footer>
<div class="container">
<div style="text-align: center;">
MAGEDDO &copy; 2016-2019 - Licensed by <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>
MAGEDDO &copy; 2016-2023 - Licensed by <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>
</div>
</div>
</footer>
Expand Down
5 changes: 3 additions & 2 deletions app/src/components/RecordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ export class RecordForm extends React.Component {
contentType: 'application/json',
data: JSON.stringify({
...this.state.form,
env: this.props.env
}),
env: this.props.env,
ip: this.state.form.type === 'A' ? this.state.form.ip : null
}),
})
.done(function(){
window.$.notify({
Expand Down
Loading

0 comments on commit 1742a9d

Please sign in to comment.