fix: reorder wsl checks on windows docker installation to reduce executation if elevated privileges
This commit is contained in:
parent
18dccf9fb8
commit
acf4e95e08
7 changed files with 119 additions and 75 deletions
1
build.sh
1
build.sh
|
|
@ -57,6 +57,7 @@ fyne-cross windows \
|
|||
-name "$NAME.exe" \
|
||||
-ldflags "-s" \
|
||||
-ldflags "-w" \
|
||||
-ldflags "-H=windowsgui" \
|
||||
./cmd/jws
|
||||
|
||||
mv fyne-cross/dist/windows-amd64/jws.exe.zip packages/jws_windows.zip
|
||||
|
|
|
|||
18
changelog.md
18
changelog.md
|
|
@ -2,6 +2,23 @@
|
|||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.2.0] - 2025-03-20
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Add jakarta-todo-jsp implementation
|
||||
- Improve usability by including a progressbar while installing packages on windows and mac
|
||||
- Improve docker installation process by adding wsl feature activation
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Reanble window resize to better support multi monitor setups with different resolutions
|
||||
- Disable password dialog on windows
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Add .devcontainer directory to jakarta jsp project directory
|
||||
|
||||
## [0.1.0] - 2025-03-19
|
||||
|
||||
### 🚀 Features
|
||||
|
|
@ -12,6 +29,7 @@ All notable changes to this project will be documented in this file.
|
|||
### 📚 Documentation
|
||||
|
||||
- Add changelog.md
|
||||
- Fix missing version info in changelog.md
|
||||
|
||||
## [0.0.2] - 2025-03-17
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,12 @@
|
|||
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye
|
||||
FROM icr.io/appcafe/open-liberty:23.0.0.4-kernel-slim-java17-openj9-ubi
|
||||
|
||||
ARG INSTALL_MAVEN="true"
|
||||
ARG MAVEN_VERSION=""
|
||||
COPY --chown=1001:0 src/main/liberty/config /config
|
||||
# # Verzeichnis erstellen und PostgreSQL JDBC-Treiber herunterladen
|
||||
RUN mkdir -p /config/lib && \
|
||||
curl -o /config/lib/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.6.0.jar
|
||||
|
||||
ARG INSTALL_GRADLE="false"
|
||||
ARG GRADLE_VERSION=""
|
||||
RUN features.sh
|
||||
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
COPY --chown=1001:0 target/*.war /config/apps
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
# [Optional] Uncomment this line to install global node packages.
|
||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
||||
RUN configure.sh
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye
|
||||
|
||||
#ARG INSTALL_MAVEN="true"
|
||||
#ARG MAVEN_VERSION=""
|
||||
|
||||
#ARG INSTALL_GRADLE="false"
|
||||
#ARG GRADLE_VERSION=""
|
||||
|
||||
#RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
# && if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
|
||||
# Hier kannst du zusätzliche Tools oder Bibliotheken installieren, die du für die Entwicklung benötigst.
|
||||
# Zum Beispiel den PostgreSQL JDBC-Treiber, wenn du ihn für die Entwicklung benötigst:
|
||||
RUN apt-get update && apt-get install -y curl && curl -o /tmp/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.6.0.jar && mkdir -p /usr/local/lib/ && mv /tmp/postgresql.jar /usr/local/lib/postgresql.jar
|
||||
|
|
@ -3,7 +3,12 @@
|
|||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||
"forwardPorts": [9080, 5432],
|
||||
"forwardPorts": [9080, 5432, 9433],
|
||||
"postCreateCommand": "mvn clean install -DskipTests",
|
||||
"remoteUser": "vscode"
|
||||
"remoteUser": "vscode",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {"version": "latest"},
|
||||
"ghcr.io/devcontainers-extra/features/maven-sdkman:2": {"version": "latest"},
|
||||
"ghcr.io/devcontainers/features/git:1": {"version": "latest"}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +1,56 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
app:
|
||||
container_name: javadev
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: .devcontainer/Dockerfile.dev
|
||||
volumes:
|
||||
- ../..:/workspaces:cached
|
||||
environment:
|
||||
POSTGRES_HOST: postgresdb
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
networks:
|
||||
- my_network
|
||||
command: sleep infinity
|
||||
|
||||
openliberty:
|
||||
container_name: openliberty_app
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
ports:
|
||||
- "9080:9080"
|
||||
- "9443:9443"
|
||||
environment:
|
||||
POSTGRES_HOST: postgresdb
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_DB: todo_db
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- my_network
|
||||
|
||||
db:
|
||||
container_name: postgresdb
|
||||
image: postgres:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: todo_db
|
||||
networks:
|
||||
- my_network
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
postgres-data:
|
||||
|
||||
services:
|
||||
app:
|
||||
container_name: javadev
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
# NOTE: POSTGRES_DB/USER/PASSWORD should match values in db container
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_HOSTNAME: postgresdb
|
||||
|
||||
volumes:
|
||||
- ../..:/workspaces:cached
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
||||
|
||||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||
network_mode: service:db
|
||||
|
||||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
db:
|
||||
container_name: postgresdb
|
||||
image: postgres:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
# NOTE: POSTGRES_DB/USER/PASSWORD should match values in app container
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
|
||||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
networks:
|
||||
my_network:
|
||||
driver: bridge
|
||||
|
|
|
|||
|
|
@ -105,8 +105,10 @@ func InstallDependency(index int, sudoPassword string, dependencies []Dependency
|
|||
}
|
||||
case "darwin":
|
||||
cmd, err = installDarwinDependencies(index, cmd, &mainWindow)
|
||||
dialog.ShowError(err, mainWindow)
|
||||
log.Error(err.Error())
|
||||
if err != nil {
|
||||
dialog.ShowError(err, mainWindow)
|
||||
log.Error(err.Error())
|
||||
}
|
||||
case "linux":
|
||||
err = installLinuxDependencies(index, sudoPassword, cmd, dependencies, &mainWindow)
|
||||
if err != nil {
|
||||
|
|
@ -126,34 +128,31 @@ func installWindowsDependencies(index int, cmd *exec.Cmd, mainWindow *fyne.Windo
|
|||
cmd = tools.CommandInShell("winget", "install", "-e", "--id",
|
||||
"Microsoft.VisualStudioCode")
|
||||
case 1: // Docker Desktop
|
||||
wslEnabled, err := checkWslFeaturesEnabled()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error checking WSL features: %v", err)
|
||||
}
|
||||
|
||||
if !wslEnabled {
|
||||
dialog.ShowInformation("activate wsl", "WSL has to be activated. Please confirm to active necessary features.", *mainWindow)
|
||||
err = enableWslFeatures()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error enabling WSL features: %v", err)
|
||||
}
|
||||
dialog.ShowInformation("reboot required", "Please reboot your PC to finish wsl activation and reopen 'jws'.", *mainWindow)
|
||||
return nil, fmt.Errorf("reboot required")
|
||||
}
|
||||
|
||||
wslCheckCmd := tools.CommandInShell("wsl", "--status")
|
||||
err = wslCheckCmd.Run()
|
||||
err := wslCheckCmd.Run()
|
||||
if err != nil {
|
||||
wslInstallCmd := tools.CommandInShell("wsl", "--install", "ubuntu")
|
||||
dialog.ShowInformation("installing wsl", "WSL will be installed. Please wait untill installation is finished and reopen 'jws'.", *mainWindow)
|
||||
err = wslInstallCmd.Run()
|
||||
if err != nil {
|
||||
wslEnabled, err := checkWslFeaturesEnabled()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error checking WSL features: %v", err)
|
||||
}
|
||||
if !wslEnabled {
|
||||
dialog.ShowInformation("activate wsl", "WSL has to be activated. Please confirm to active necessary features.", *mainWindow)
|
||||
err = enableWslFeatures()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error enabling WSL features: %v", err)
|
||||
}
|
||||
dialog.ShowInformation("reboot required", "Please reboot your PC to finish wsl activation and reopen 'jws'.", *mainWindow)
|
||||
return nil, fmt.Errorf("reboot required")
|
||||
}
|
||||
errMsg := fmt.Errorf("error: installing WSL: %v", err)
|
||||
return nil, errMsg
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cmd = tools.CommandInShell("winget", "install", "-e", "--id",
|
||||
"Docker.DockerDesktop")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue