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`.
This commit is contained in:
Anbraten 2022-07-31 17:07:18 +02:00 committed by GitHub
parent 01bfbba458
commit 5557674835
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 161 additions and 12 deletions

79
.gitpod.yml Normal file
View file

@ -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"

View file

@ -1,6 +1,6 @@
<p align="center"> <p align="center">
<a href="https://github.com/woodpecker-ci/woodpecker/"> <a href="https://github.com/woodpecker-ci/woodpecker/">
<img alt="Woodpecker" src="https://raw.githubusercontent.com/woodpecker-ci/woodpecker/master/docs/static/img/logo.svg" width="220"/> <img alt="Woodpecker" src="docs/static/img/logo-auto-darkmode.svg" width="220"/>
</a> </a>
</p> </p>
<br/> <br/>
@ -44,12 +44,13 @@
![woodpecker](docs/docs/woodpecker.png) ![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)] Please consider to donate and become a backer. 🙏 [[Become a backer](https://opencollective.com/woodpecker-ci#category-CONTRIBUTE)]
<a href="https://opencollective.com/woodpecker-ci" target="_blank"><img src="https://opencollective.com/woodpecker-ci/backers.svg?width=890"></a> <a href="https://opencollective.com/woodpecker-ci" target="_blank"><img src="https://opencollective.com/woodpecker-ci/backers.svg?width=890"></a>
## Usage ## 🚀 Usage
### .woodpecker.yml ### .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) [Read More](https://woodpecker-ci.org/docs/usage/plugins/plugins)
## Documentation ## 📖 Documentation
https://woodpecker-ci.org/ https://woodpecker-ci.org/
## Contribution ## ✨ Contribute
See [Contributing Guide](CONTRIBUTING.md) 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 Leave a [comment](https://github.com/woodpecker-ci/woodpecker/issues/122) if you're using it as well.
from your config and use the hashtag `#WoodpeckerCI` when talking about the project on social media!
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: 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) - [Twitter](https://twitter.com/hashtag/WoodpeckerCI?f=live)
- [Fediverse](https://mastodon.social/tags/WoodpeckerCI) - [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) [![Stargazers over time](https://starchart.cc/woodpecker-ci/woodpecker.svg)](https://starchart.cc/woodpecker-ci/woodpecker)
## License ## License

41
docker-compose.gitpod.yml Normal file
View file

@ -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:

View file

@ -1,6 +1,22 @@
# Getting started # 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 ### Install Go

10
docs/static/img/logo-auto-darkmode.svg vendored Normal file
View file

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22">
<style>
@media (prefers-color-scheme: dark) {
path {
fill: white;
}
}
</style>
<path d="M1.263 2.744C2.41 3.832 2.845 4.932 4.118 5.08l.036.007c-.588.606-1.09 1.402-1.443 2.423-.38 1.096-.488 2.285-.614 3.659-.19 2.046-.401 4.364-1.556 7.269-2.486 6.258-1.12 11.63.332 17.317.664 2.604 1.348 5.297 1.642 8.107a.857.857 0 00.633.744.86.86 0 00.922-.323c.227-.313.524-.797.86-1.424.84 3.323 1.355 6.13 1.783 8.697a.866.866 0 001.517.41c2.88-3.463 3.763-8.636 2.184-12.674.459-2.433 1.402-4.45 2.398-6.583.536-1.15 1.08-2.318 1.55-3.566.228-.084.569-.314.79-.441l1.707-.981-.256 1.052a.864.864 0 001.678.408l.68-2.858 1.285-2.95a.863.863 0 10-1.581-.687l-1.152 2.669-2.383 1.372a18.97 18.97 0 00.508-2.981c.432-4.86-.718-9.074-3.066-11.266-.163-.157-.208-.281-.247-.26.095-.12.249-.26.358-.374 2.283-1.693 6.047-.147 8.319.75.589.232.876-.337.316-.67-1.95-1.153-5.948-4.196-8.188-6.193-.313-.275-.527-.607-.89-.913C9.825.555 4.072 3.057 1.355 2.569c-.102-.018-.166.103-.092.175m10.98 5.899c-.06 1.242-.603 1.8-1 2.208-.217.224-.426.436-.524.738-.236.714.008 1.51.66 2.143 1.974 1.84 2.925 5.527 2.538 9.86-.291 3.288-1.448 5.763-2.671 8.385-1.031 2.207-2.096 4.489-2.577 7.259a.853.853 0 00.056.48c1.02 2.434 1.135 6.197-.672 9.46a96.586 96.586 0 00-1.97-8.711c1.964-4.488 4.203-11.75 2.919-17.668-.325-1.497-1.304-3.276-2.387-4.207-.208-.18-.402-.237-.495-.167-.084.06-.151.238-.062.444.55 1.266.879 2.599 1.226 4.276 1.125 5.443-.956 12.49-2.835 16.782l-.116.259-.457.982c-.356-2.014-.85-3.95-1.33-5.84-1.38-5.406-2.68-10.515-.401-16.254 1.247-3.137 1.483-5.692 1.672-7.746.116-1.263.216-2.355.526-3.252.905-2.605 3.062-3.178 4.744-2.852 1.632.316 3.24 1.593 3.156 3.42zm-2.868.62a1.177 1.177 0 10.736-2.236 1.178 1.178 0 10-.736 2.237z" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB