Skip to content

Commit

Permalink
Add Gitpod config (#2000)
Browse files Browse the repository at this point in the history
Hi @JanCizmar !

I wanted to help with setting up a Gitpod config. You can try it out by
opening this link:
https://gitpod.io/#https://github.com/tolgee/tolgee-platform/pull/2000
(use the **Large** 8-core machine for better performance)

And if you find it appropriate, could you add the following message at
the top of https://github.com/tolgee/tolgee-platform/wiki/Development ?
It could be helpful for contributors.

```markdown
## Getting Started with Gitpod

To quickly start, open this link: [https://gitpod.io/#github.com/tolgee/tolgee-platform](https://gitpod.io/#github.com/tolgee/tolgee-platform) to create a CDE for this repository.

A [CDE](https://www.gitpod.io/cde) will be created for you with your preferred editor (such as VSCode, Jetbrains, or SSH). All the necessary dependencies are automatically installed, and the tolgee-platform source code will be pre-built according to the [.gitpod.yml](/.gitpod.yml) file, this allows you to get started in just a few seconds.
```
  • Loading branch information
axonasif authored Nov 28, 2023
1 parent 5f04aeb commit a023cd4
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# See https://www.gitpod.io/docs/introduction/languages/java

image:
file: docker/gitpod.Dockerfile

tasks:
- name: Build cache
openMode: tab-before
init: |
(
# Frontend cache
rm -f /workspace/.f
pushd webapp
npm ci
popd
touch /workspace/.f
) &
# Backend cache
rm -f /workspace/.b
./gradlew server-app:unpack
touch /workspace/.b
- name: Backend
openMode: split-left
command: |
until test -e /workspace/.b; do sleep 1; done
./gradlew server-app:bootRun --args='--spring.profiles.active=dev'
- name: Frontend
openMode: split-right
command: |
printf "\033[3J\033c\033[3J"
# Fix API server address for Gitpod VSCode Web
echo "REACT_APP_API_URL=$(gp url 8080)" > webapp/.env.local
until test -e /workspace/.f; do sleep 1; done
# Schedule auto-refresh for the webapp preview window after backend is fully up,
# as the webapp will probably have an error on the first render.
(
until curl -s -o /dev/null http://localhost:3000; do continue; done
echo "> GITPOD-INFO: Backend server might not be ready at port 8080 yet, expect error on webapp/frontend preview"
(while true; do sleep 1; echo -n .; done) &
gp ports await 8080 && kill $!
echo "> GITPOD-INFO: Refreshing webapp/frontend preview at port 3000"
gp preview "$(gp url 3000)"
) &
cd webapp && BROWSER='' npm run start
ports:
- name: Backend
port: 8080
visibility: public
onOpen: ignore

- name: Frontend
port: 3000
visibility: public
onOpen: open-preview

- port: 15000-50000
onOpen: ignore
description: Misc.

vscode:
extensions:
- vscjava.vscode-java-pack
9 changes: 9 additions & 0 deletions docker/gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Src: https://github.com/gitpod-io/workspace-images/tree/main/chunks/lang-java
FROM gitpod/workspace-java-17@sha256:9afcbfd630163f00cab4bceab2d041e028c5b774019a40cb533f17d7ffa98350

# Merge workspace-node image to workspace-java-17
# Src: https://github.com/gitpod-io/workspace-images/tree/main/chunks/lang-node
COPY --from=gitpod/workspace-node@sha256:08e175d076c1197774438c8a26cc978a9cde5f96795ccd0ebce0c2b6f5035170 / /
ENV NODE_VERSION=21.2.0
ENV PNPM_HOME=/home/gitpod/.pnpm
ENV PATH=/home/gitpod/.nvm/versions/node/v${NODE_VERSION}/bin:/home/gitpod/.yarn/bin:${PNPM_HOME}:$PATH

0 comments on commit a023cd4

Please sign in to comment.