Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
faermanj authored May 11, 2024
0 parents commit 4721b2b
Show file tree
Hide file tree
Showing 26 changed files with 1,511 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: CaravanaCloud
30 changes: 30 additions & 0 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Project

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch: {}


jobs:
build-project:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-
- name: Maven
run: mvn --batch-mode --update-snapshots
21 changes: 21 additions & 0 deletions .github/workflows/lint-java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Java Lint

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch: {}


jobs:
lint-java:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: dbelyaev/action-checkstyle@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: warning
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
35 changes: 35 additions & 0 deletions .gitpod.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# docker build --no-cache --progress=plain -f .gitpod.Containerfile .
FROM gitpod/workspace-full

# System
RUN bash -c "sudo install-packages gettext postgresql-client"
RUN bash -c "sudo apt-get update"
RUN bash -c "sudo pip install --upgrade pip"

# Java
ARG JAVA_SDK="22-graalce"
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh \
&& sdk install java $JAVA_SDK \
&& sdk default java $JAVA_SDK \
&& sdk install quarkus \
&& sdk install maven \
&& sdk install jbang \
&& sdk install jreleaser \
"

# AWS CLIs
WORKDIR /tmp

RUN bash -c "curl 'https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip' -o 'awscliv2.zip' && unzip awscliv2.zip \
&& sudo ./aws/install \
&& aws --version \
"

RUN bash -c "npm install -g aws-cdk"

ARG SAM_URL="https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip"
RUN bash -c "curl -Ls '${SAM_URL}' -o '/tmp/aws-sam-cli-linux-x86_64.zip' \
&& unzip '/tmp/aws-sam-cli-linux-x86_64.zip' -d '/tmp/sam-installation' \
&& sudo '/tmp/sam-installation/install' \
&& sam --version"

69 changes: 69 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
image:
file: .gitpod.Containerfile

tasks:
- name: SHELL
init: |
java --version
mvn --version
quarkus --version
aws --version
echo "GitPod init at $(date)"
command:
echo "GitPod command at $(date)"

ports:
# DB
- port: 5432
onOpen: ignore
visibility: public

# PROXY
- port: 9999
onOpen: ignore
visibility: public

# WEB
- port: 8080
onOpen: ignore
visibility: public

- port: 9090
onOpen: ignore
visibility: public

# API
- port: 9001
onOpen: ignore
visibility: public

# OTHER MODULES
# - port: 900X
# onOpen: ignore
# visibility: public

# Debugger
- port: 5005
onOpen: ignore
visibility: private

# OTHERS PORTS
- port: 24000
onOpen: ignore
visibility: private

vscode:
extensions:
- vscjava.vscode-java-pack
- vscjava.vscode-java-debug
- vscjava.vscode-java-dependency
- vscjava.vscode-java-test
- vscjava.vscode-maven
- redhat.java
- esbenp.prettier-vscode
- svelte.svelte-vscode
- ms-vscode.vscode-typescript-next

#additionalRepositories:
#
# - url: https://github.com/CaravanaCloud/PROJECT-secrets
5 changes: 5 additions & 0 deletions .quarkus/cli/plugins/quarkus-cli-catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version" : "v1",
"lastUpdate" : "24/04/2024 10:48:35",
"plugins" : { }
}
25 changes: 25 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>cloud.caravana</groupId>
<artifactId>quarkus-template</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>

<modules>
<module>samples/pizzas-api</module>
</modules>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>verify</defaultGoal>
</build>

</project>
149 changes: 149 additions & 0 deletions samples/docs/wsl-howto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# How to setup a developer environment on Linux or Windows Subsystem for Linux?

Run powershell (cmd+R > powershell)

Check WSL
```
wsl --version
```
https://learn.microsoft.com/en-us/windows/wsl/install#install-wsl-

Check winget
```
winget --version
```
https://learn.microsoft.com/en-us/windows/package-manager/winget/

Install 7zip
```
winget install --id 7zip.7zip
```

Download and extract the Fedora base container (Powershell)
```pwsh
$DownloadURL = "https://kojipkgs.fedoraproject.org/packages/Fedora-Container-Base/40/20240222.n.0/images/Fedora-Container-Base-40-20240222.n.0.x86_64.tar.xz"
$OutputFile = "$env:USERPROFILE\Downloads\Fedora-Container-Base-40-20240222.n.0.x86_64.tar.xz"
Invoke-WebRequest -Uri $DownloadURL -OutFile $OutputFile
$7ZipExe = "C:\Program Files\7-Zip\7z.exe"
$ExtractedDir = "$env:USERPROFILE\Downloads"
$DestinationDir = "$env:USERPROFILE\Downloads\fedora-40-rootfs.tar"
Start-Process -FilePath $7ZipExe -ArgumentList "x `"$OutputFile`" -o`"$ExtractedDir`"" -Wait
$OutputFile = "$env:USERPROFILE\Downloads\" + (Get-Item $OutputFile).BaseName
Start-Process -FilePath $7ZipExe -ArgumentList "x `"$OutputFile`" -o`"$ExtractedDir`"" -Wait
$Hash = "d755805c54d9489cf9eaeb6f92b2b60f778584d8136e94952527cf7b9be28ba2"
Move-Item "$ExtractedDir\$Hash\layer.tar" $DestinationDir
```

Create a new WSL distribution for Fedora
```pwsh
$WSLName = "fedora-quarkus"
$WSLDir = "$env:USERPROFILE\wsl\$WSLName"
mkdir -p $WSLDir
$RootFSPath = "$env:USERPROFILE\Downloads\fedora-40-rootfs.tar"
wsl --import $WSLName $WSLDir $RootFSPath
```

Verify that the distribution is created
```pwsh
wsl -l -v
```

Start the Fedora WSL distribution
```pwsh
wsl -d $WSLName
```

## User Setup
In bash, as root

Install System tools
```bash
yum install @development-tools zip unzip gh which dnf-plugins-core
```


```bash
useradd builder
passwd builder
usermod -aG wheel builder
echo '[user]' > /etc/wsl.conf
echo 'default=builder' >> /etc/wsl.conf
echo '[boot]' >> /etc/wsl.conf
echo 'systemd=true' >> /etc/wsl.conf
echo '' >> /etc/wsl.conf
```

Restart WSL
```pwsh
exit
wsl --terminate $WSLName
wsl -d $WSLName
```

```bash
sudo -s

dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

groupadd docker
usermod -aG docker builder
newgrp docker

systemctl enable docker
systemctl start docker
```

## Tools Setup

Docker verification
```bash
whoami
docker ps
docker run hello-world
```

SdkMan
```bash
curl -s "https://get.sdkman.io" | bash
source "/home/builder/.sdkman/bin/sdkman-init.sh"
sdk install java 22-graalce
sdk install maven
sdk install quarkus
```

GitHub
```
cd
mkdir workspace
cd workspace
gh auth login
gh repo clone QuarkusAcademy/pizza-delivery
```

Build project
```
cd pizza-delivery
code .
mvn
```

# Ready to roll!

Install an IDE:
* VSCode and WSL Extension
https://code.visualstudio.com/insiders/
https://code.visualstudio.com/docs/remote/wsl

* IntelliJ IDEA
https://www.jetbrains.com/idea/


# After done
If necessary, delete your WSL environment (WARNING: NOT REVERSIBLE)
```pwsh
wsl --unregister $WSLName
```
5 changes: 5 additions & 0 deletions samples/pizzas-api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
Loading

0 comments on commit 4721b2b

Please sign in to comment.