Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPS 3 - Beta #286

Merged
merged 96 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
3b51ad6
Setup gradle initial project
mageddo Jan 29, 2023
d2a1a35
Gradle simple setup
mageddo Jan 29, 2023
43dd772
Setup patch version wildcards
mageddo Jan 29, 2023
6317746
will continue later
mageddo Jan 29, 2023
3b35ac1
migrating plugin
mageddo Jan 29, 2023
4571fde
setup dnsjava lib
mageddo Jan 29, 2023
187a278
Basic client server conversation
mageddo Jan 29, 2023
842d5c2
Simple remote server proxy
mageddo Jan 29, 2023
783ac1d
Native image working
mageddo Jan 29, 2023
f81d839
Dagger initial setup
mageddo Jan 29, 2023
a7c4359
Add some writer threads to udp server
mageddo Jan 29, 2023
9474d7b
creating wildcard builder
mageddo Jan 29, 2023
51eab70
working on docker solver
mageddo Jan 29, 2023
2dcfa55
configuring docker solver
mageddo Jan 29, 2023
fbd6837
adjustments
mageddo Jan 29, 2023
661d813
Fixing ip parse
mageddo Jan 29, 2023
151a9b0
docker client dep
mageddo Jan 29, 2023
38ae528
Created real docker client solver
mageddo Jan 29, 2023
d8d3e52
refactoring
mageddo Jan 29, 2023
0a7ce23
getting ip from bridge network
mageddo Jan 29, 2023
eb63bd2
Fixing hostname matching from env
mageddo Jan 29, 2023
8e70304
configuring docker client package
mageddo Jan 30, 2023
5d12964
Setup docker java client reflection
mageddo Jan 31, 2023
9cdbb30
Fixing spearator
mageddo Jan 31, 2023
eb18a1d
adjusting reflection
mageddo Jan 31, 2023
2fea9c4
adjusting reflection
mageddo Jan 31, 2023
a00f698
More reflection stuff
mageddo Jan 31, 2023
203b245
Adjusting
mageddo Jan 31, 2023
5b1b2b7
Native image log fixed
mageddo Jan 31, 2023
d05cd67
removing unnecessary files
mageddo Jan 31, 2023
45e5cb1
refactoring packages
mageddo Jan 31, 2023
eb4f9dc
unused class
mageddo Jan 31, 2023
3eb546c
fixing javadoc
mageddo Jan 31, 2023
b386d1b
unifiying
mageddo Jan 31, 2023
63a302d
Merge pull request #268 from mageddo/dps-3-dns-server
mageddo Jan 31, 2023
1e60422
quarkus working
mageddo Jan 31, 2023
284e08b
add instructions
mageddo Jan 31, 2023
b19797c
Settings
mageddo Jan 31, 2023
476a480
Setup solvers
mageddo Jan 31, 2023
5cce061
Setup missing beans
mageddo Jan 31, 2023
bd604ce
Json config contract
mageddo Jan 31, 2023
01976f8
fixing readme
mageddo Jan 31, 2023
be0e07f
clearing gradle
mageddo Jan 31, 2023
9c41d79
deleting dagger files
mageddo Jan 31, 2023
18b6099
Merge pull request #269 from mageddo/dps-3-quarkus
mageddo Jan 31, 2023
dec446c
flags structure
mageddo Jan 31, 2023
ea51e6c
Setup jcommander dependency
mageddo Jan 31, 2023
1ec5de5
some docs
mageddo Jan 31, 2023
1a5ec68
Before pico cli refactoring
mageddo Feb 1, 2023
d5fd92a
Setup pico cli
mageddo Feb 1, 2023
7c6f537
testing flagts
mageddo Feb 1, 2023
f2da673
Some tests created
mageddo Feb 1, 2023
4d3c7c7
Fixing help formatting
mageddo Feb 1, 2023
c358ed6
Testing the version
mageddo Feb 1, 2023
bc19537
Setup version get
mageddo Feb 1, 2023
937a844
setup help
mageddo Feb 1, 2023
4706d69
refactoring
mageddo Feb 1, 2023
afe7ed1
Setup configs
mageddo Feb 1, 2023
dc8242a
Simplifying
mageddo Feb 1, 2023
fd9c263
Refactoring
mageddo Feb 1, 2023
d575225
javadoc
mageddo Feb 1, 2023
4d0c29e
Mapping json and env configs
mageddo Feb 2, 2023
4d480b3
Mapped configs
mageddo Feb 2, 2023
5b9affa
Test is passing
mageddo Feb 2, 2023
2819298
Adjusting tests
mageddo Feb 2, 2023
32afb41
More tests
mageddo Feb 2, 2023
b482136
Fixing tests
mageddo Feb 2, 2023
0d32bc6
Customizing http server port
mageddo Feb 2, 2023
f95cd84
configuring log level
mageddo Feb 2, 2023
d844e14
Keep going
mageddo Feb 2, 2023
7a8e33c
All configs matched
mageddo Feb 2, 2023
1523bae
Implementing and test config json v1
mageddo Feb 2, 2023
0fd5df7
formatting
mageddo Feb 2, 2023
46aa13b
Fixing test
mageddo Feb 2, 2023
dd2fb10
Fixing test
mageddo Feb 2, 2023
baae29c
Fixing quarkus startup for testing
mageddo Feb 2, 2023
d5f9c87
otimization
mageddo Feb 2, 2023
834e168
Merge pull request #270 from mageddo/dps-3-flags
mageddo Feb 2, 2023
4bc535e
DPS 3 - System Solver (#271)
mageddo Feb 2, 2023
35f7d0f
DPS 3 - Remote solver complete (#272)
mageddo Feb 3, 2023
be57be8
DPS 3 - Local DB Solver (#273)
mageddo Feb 6, 2023
c20cefd
DPS 3 - Docker networks (#274)
mageddo Feb 7, 2023
ebd6f1f
DPS 3 - Docker Register Service Names (#275)
mageddo Feb 8, 2023
64e15f8
checking docker is connected (#276)
mageddo Feb 8, 2023
1924903
Fixing tests (#277)
mageddo Feb 8, 2023
fec0c75
created active env api
mageddo Feb 8, 2023
4db7eff
Ignoring static folder
mageddo Feb 8, 2023
dde3528
DPS 3 - GUI REST API (#278)
mageddo Feb 8, 2023
e445b59
DPS - 3 LocalDB Solver CNAME Support (#279)
mageddo Feb 9, 2023
f1f72ba
DPS 3 - Auto Configure (#280)
mageddo Feb 17, 2023
bdf6d53
DPS - 3 DNS Resolution Hangs Fixes (#281)
mageddo Feb 18, 2023
127db7d
DPS 3 - Minimal debug log (#282)
mageddo Feb 18, 2023
4c63341
Fixing compiling errors
mageddo Feb 18, 2023
da12c9d
deleting v2 files (#283)
mageddo Feb 18, 2023
d7ee4d5
Deleting
mageddo Feb 18, 2023
ae6f8fe
DPS 3 - CI/CD (#284)
mageddo Feb 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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