From 555767483525f614624f4fe56c59a85a38f8888e Mon Sep 17 00:00:00 2001 From: Anbraten Date: Sun, 31 Jul 2022 17:07:18 +0200 Subject: [PATCH] Add gitpod setup (#1020) Adding [Gitpod](https://github.com/gitpod-io/gitpod) allows us and others to easily start a complete Woodpecker setup and development cloud IDE. It starts a Woodpecker server, agent and a preconfigured Gitea instance. You can login at Gitea with `woodpecker` and `password`. --- .gitpod.yml | 79 +++++++++++++++++++ README.md | 25 +++--- docker-compose.gitpod.yml | 41 ++++++++++ .../docs/92-development/01-getting-started.md | 18 ++++- docs/static/img/logo-auto-darkmode.svg | 10 +++ 5 files changed, 161 insertions(+), 12 deletions(-) create mode 100644 .gitpod.yml create mode 100644 docker-compose.gitpod.yml create mode 100644 docs/static/img/logo-auto-darkmode.svg diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 000000000..c5268345d --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,79 @@ +tasks: + - name: Server + env: + WOODPECKER_OPEN: true + WOODPECKER_ADMIN: woodpecker + WOODPECKER_HOST: http://host.docker.internal:8000 + WOODPECKER_SECRET: "1234" + WOODPECKER_GITEA: true + WOODPECKER_DEV_WWW_PROXY: http://localhost:8010 + WOODPECKER_BACKEND_DOCKER_NETWORK: ci_default + init: | + go mod tidy + mkdir -p web/dist + touch web/dist/index.html + echo WOODPECKER_GITEA_URL=https://3000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST} >> .env + echo WOODPECKER_DEV_OAUTH_HOST=https://8000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST} >> .env + gp sync-await gitea + gp sync-done woodpecker-server + command: go run github.com/woodpecker-ci/woodpecker/cmd/server + - name: Agent + env: + WOODPECKER_SERVER: localhost:9000 + WOODPECKER_SECRET: "1234" + WOODPECKER_MAX_PROCS: 1 + WOODPECKER_HEALTHCHECK: false + init: | + gp sync-await woodpecker-server + command: go run github.com/woodpecker-ci/woodpecker/cmd/agent + - name: Gitea + command: | + export DOCKER_COMPOSE_CMD="docker-compose -f docker-compose.gitpod.yml -p woodpecker" + export GITEA_CLI_CMD="$DOCKER_COMPOSE_CMD exec -u git gitea gitea" + $DOCKER_COMPOSE_CMD up -d + sleep 10s + $GITEA_CLI_CMD admin user create --username woodpecker --password password --email woodpecker@localhost --admin + export GITEA_TOKEN=$($GITEA_CLI_CMD admin user generate-access-token -u woodpecker --raw) + GITEA_OAUTH_APP=$(curl -X 'POST' 'http://localhost:3000/api/v1/user/applications/oauth2' \ + -H 'accept: application/json' -H 'Content-Type: application/json' -H "Authorization: token ${GITEA_TOKEN}" \ + -d "{ \"name\": \"Woodpecker CI\", \"redirect_uris\": [ \"https://8000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}/authorize\" ] }") + echo WOODPECKER_GITEA_CLIENT=$(echo $GITEA_OAUTH_APP | jq -r .client_id) >> .env + echo WOODPECKER_GITEA_SECRET=$(echo $GITEA_OAUTH_APP | jq -r .client_secret) >> .env + gp sync-done gitea + $DOCKER_COMPOSE_CMD logs -f + - name: App + init: | + cd web/ + yarn install + command: yarn start + - name: Docs + init: | + cd docs/ + yarn install + yarn build:woodpecker-plugins + command: yarn start --port 4000 + +ports: + - port: 3000 + onOpen: ignore + visibility: public # TODO: https://github.com/woodpecker-ci/woodpecker/issues/856 + - port: 8000 + onOpen: notify + visibility: public # TODO: https://github.com/woodpecker-ci/woodpecker/issues/856 + - port: 9000 + onOpen: ignore + - port: 8010 + onOpen: ignore + - port: 4000 + onOpen: notify + +vscode: + extensions: + - "golang.go" + - "EditorConfig.EditorConfig" + - "dbaeumer.vscode-eslint" + - "esbenp.prettier-vscode" + - "voorjaar.windicss-intellisense" + - "johnsoncodehk.volar" + - "redhat.vscode-yaml" + - "davidanson.vscode-markdownlint" diff --git a/README.md b/README.md index f951afebf..b75aa524b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- Woodpecker + Woodpecker


@@ -44,12 +44,13 @@ ![woodpecker](docs/docs/woodpecker.png) -## Support +## 🫶 Support Please consider to donate and become a backer. 🙏 [[Become a backer](https://opencollective.com/woodpecker-ci#category-CONTRIBUTE)] + -## Usage +## 🚀 Usage ### .woodpecker.yml @@ -72,22 +73,23 @@ Woodpecker has [official plugins](https://woodpecker-ci.org/plugins), but you ca [Read More](https://woodpecker-ci.org/docs/usage/plugins/plugins) -## Documentation +## 📖 Documentation https://woodpecker-ci.org/ -## Contribution +## ✨ Contribute See [Contributing Guide](CONTRIBUTING.md) -## Who uses Woodpecker? +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://woodpecker-ci.org/docs/development/getting-started#preparation-for-local-development) -[Codeberg](https://codeberg.org), the woodpecker project itself, and many others. +## 👋 Who uses Woodpecker? -Leave a [comment](https://github.com/woodpecker-ci/woodpecker/issues/122) if you're using it. +[Codeberg](https://codeberg.org), the Woodpecker project itself, and many others. -Also consider using the topic `WoodpeckerCI` in your repository, so others can learn -from your config and use the hashtag `#WoodpeckerCI` when talking about the project on social media! +Leave a [comment](https://github.com/woodpecker-ci/woodpecker/issues/122) if you're using it as well. + +Also consider using the topic `WoodpeckerCI` in your repository, so others can learn from your config and use the hashtag `#WoodpeckerCI` when talking about the project on social media! Here are some places where people mention Woodpecker: @@ -96,7 +98,8 @@ Here are some places where people mention Woodpecker: - [Twitter](https://twitter.com/hashtag/WoodpeckerCI?f=live) - [Fediverse](https://mastodon.social/tags/WoodpeckerCI) -## Stars over time +## ✨ Stars over time + [![Stargazers over time](https://starchart.cc/woodpecker-ci/woodpecker.svg)](https://starchart.cc/woodpecker-ci/woodpecker) ## License diff --git a/docker-compose.gitpod.yml b/docker-compose.gitpod.yml new file mode 100644 index 000000000..f7c8af7cb --- /dev/null +++ b/docker-compose.gitpod.yml @@ -0,0 +1,41 @@ +version: '3' + +services: + gitea-database: + image: postgres:12.6-alpine + environment: + POSTGRES_USER: gitea + POSTGRES_PASSWORD: 123456 + POSTGRES_DB: gitea + PGDATA: /var/lib/postgresql/data/pgdata + volumes: + - pgsql:/var/lib/postgresql/data/pgdata + + gitea: + image: gitea/gitea:dev + ports: + - 3000:3000 + volumes: + - gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + depends_on: + - gitea-database + environment: + USER_UID: 1000 + USER_GID: 1000 + # GITEA__server__DOMAIN: gitea.local.self + GITEA__server__ROOT_URL: http://gitea:3000 + GITEA__database__DB_TYPE: postgres + GITEA__database__HOST: gitea-database:5432 + GITEA__database__NAME: gitea + GITEA__database__USER: gitea + GITEA__database__PASSWD: 123456 + GITEA__webhook__ALLOWED_HOST_LIST: "*" + GITEA__security__INSTALL_LOCK: "true" + extra_hosts: + - "host.docker.internal:host-gateway" + +volumes: + gitea: + pgsql: diff --git a/docs/docs/92-development/01-getting-started.md b/docs/docs/92-development/01-getting-started.md index ac4245dee..55a47db9f 100644 --- a/docs/docs/92-development/01-getting-started.md +++ b/docs/docs/92-development/01-getting-started.md @@ -1,6 +1,22 @@ # Getting started -## Preparation +You can develop on your local computer by following the [steps below](#preparation-for-local-development) or you can start with a fully prepared online setup using [Gitpod](https://github.com/gitpod-io/gitpod) and [Gitea](https://github.com/go-gitea/gitea). + +## Gitpod + +If you want to start development or updating docs as easy as possible you can use our preconfigured setup for Woodpecker using [Gitpod](https://github.com/gitpod-io/gitpod). Gitpod starts a complete development setup in the cloud containing: + +- An IDE in the browser or bridged to your local VS-Code or Jetbrains +- A preconfigured [Gitea](https://github.com/go-gitea/gitea) instance as forge +- A preconfigured Woodpecker server +- A single preconfigured Woodpecker agent node +- Our docs preview server + +Simply start Woodpecker in Gitpod by clicking on the following badge. You can login with `woodpecker` and `password`. + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/woodpecker-ci/woodpecker) + +## Preparation for local development ### Install Go diff --git a/docs/static/img/logo-auto-darkmode.svg b/docs/static/img/logo-auto-darkmode.svg new file mode 100644 index 000000000..7cf777c4a --- /dev/null +++ b/docs/static/img/logo-auto-darkmode.svg @@ -0,0 +1,10 @@ + + + +