Drone: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 14: Line 14:
| <code>$DRONE_HOME/data</code> || <code>/data</code> || Application data
| <code>$DRONE_HOME/data</code> || <code>/data</code> || Application data
|}
|}
==Docker==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
docker run -it --rm \
docker run -it --rm \
Line 135: Line 137:
cat <<-'EOF' | sudo su
cat <<-'EOF' | sudo su
mkdir -p /opt/cli/drone-linux-amd64/bin/
mkdir -p /opt/cli/drone-linux-amd64/bin/
wget -qO- https://github.com/drone/drone-cli/releases/download/v0.8.6/\
wget -qO- https://github.com/harness/drone-cli/releases/latest/download/\
drone_linux_amd64.tar.gz | tar -xzf - -C /opt/cli/drone-linux-amd64/bin/
drone_linux_amd64.tar.gz | tar -xzf - -C /opt/cli/drone-linux-amd64/bin/


Line 143: Line 145:
EOF
EOF
</syntaxhighlight>
</syntaxhighlight>
==Playground==
{|
| valign="top" |
<syntaxhighlight lang="bash">
mkdir -p ~/Documents/drone-playground/
      cd ~/Documents/drone-playground/
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
export DRONE_TOKEN=yClIwgxje1hmP7bLSr1Y3vilNgS1ANyG
export DRONE_SERVER=https://cdn.chorke.org
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
drone user info chorke.academia
drone user ls
</syntaxhighlight>
|-
| colspan="3" |
----
|-
| valign="top" |
<syntaxhighlight lang="bash">
drone build ls chorke/academia-core-utility
drone build ls -h
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
drone registry ls chorke/academia-core-utility
drone registry ls -h
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
drone secret ls chorke/academia-core-utility
drone secret ls -h
</syntaxhighlight>
|-
| colspan="3" |
----
|-
| valign="top" |
<syntaxhighlight lang="bash">
drone deploy -h
drone cron -h
drone exec -h
drone repo -h
drone sign -h
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
drone secret add \
-repository chorke/academia-core-utility \
-data @./cdn.chorke.org/id_ed25519 \
-name SSH_PRIVATE_KEY \
-allow-pull-request
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
drone secret add \
-repository chorke/academia-core-utility \
-name DEPLOY_HOST \
-allow-pull-request
</syntaxhighlight>
|-
| colspan="3" |
----
|-
| valign="top" |
<syntaxhighlight lang="bash">
drone secret ls \
-repository chorke/academia-core-utility
drone orgsecret ls
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
drone secret rm \
-repository chorke/academia-core-utility \
-name SSH_PRIVATE_KEY
</syntaxhighlight>
| valign="top" |
|}


==Knowledge==
==Knowledge==
Line 154: Line 252:


|valign='top'|
|valign='top'|
  sudo lsof -i -P -n | grep LISTEN
  sudo lsof -i -P -n | grep  
openssl rand -hex 16


|valign='top'|
|valign='top'|
Line 198: Line 297:
| valign="top" |
| valign="top" |
* [https://0-8-0.docs.drone.io/setup-with-nginx/ Drone » Nginx Reverse Proxy]
* [https://0-8-0.docs.drone.io/setup-with-nginx/ Drone » Nginx Reverse Proxy]
* [https://stackoverflow.com/questions/41330947/ Drone » Create A Secret File]
* [https://docs.drone.io/server/provider/gitlab/ Drone » GitLab » Pipeline]
* [https://docs.oldtimes.me/drone/cli-secret-add/ Drone » CLI » Secret Add]
* [https://docs.drone.io/cli/install/ Drone » CLI Installation]
* [[Drone Pipeline|Drone » Pipeline]]


|-
|-

Latest revision as of 20:43, 20 October 2024

Linux:
export DRONE_HOME=/srv/drone
MacOS:
export DRONE_HOME=$HOME/drone
Local location Container location Usage
$DRONE_HOME/data /data Application data

Docker

docker run -it --rm \
--env=DRONE_AGENTS_ENABLED=true \
--env=DRONE_GITLAB_SERVER=https://academia.chorke.org/gitlab \
--env=DRONE_GITLAB_CLIENT_ID=${DRONE_GITLAB_CLIENT_ID:-c955d25b77a4fef47fb87cea0b2aba99} \
--env=DRONE_GITLAB_CLIENT_SECRET=${DRONE_GITLAB_CLIENT_SECRET:-ae74931239cc242bdddb063d2c4e1003} \
--env=DRONE_RPC_SECRET=58af6e764c227641e80ba91c4692bdd6 \
--env=DRONE_SERVER_HOST=10.19.83.10 \
--env=DRONE_SERVER_PROTO=http \
--name=drone \
--detach=true \
--publish=80:80 \
--publish=443:443 \
drone/drone:latest

docker exec -it drone id
docker stop drone
docker run -it --rm \
--env=DRONE_RPC_PROTO=http \
--env=DRONE_RUNNER_CAPACITY=2 \
--env=DRONE_RPC_HOST=10.19.83.10 \
--env=DRONE_RUNNER_NAME=drone-runner \
--env=DRONE_RPC_SECRET=58af6e764c227641e80ba91c4692bdd6 \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--detach=true \
--publish=3000:3000 \
--name=drone-runner \
drone/drone-runner-docker:latest

docker exec -it drone-runner id
docker stop drone-runner
mkdir -p $DRONE_HOME/{data}
#chown -R 0:0 $DRONE_HOME/

Server

Debian


docker run \
--volume ${DRONE_HOME}/data:/data \
--env=DRONE_AGENTS_ENABLED=true \
--env=DRONE_GITLAB_SERVER=https://academia.chorke.org/gitlab \
--env=DRONE_GITLAB_CLIENT_ID=${DRONE_GITLAB_CLIENT_ID:-c955d25b77a4fef47fb87cea0b2aba99} \
--env=DRONE_GITLAB_CLIENT_SECRET=${DRONE_GITLAB_CLIENT_SECRET:-ae74931239cc242bdddb063d2c4e1003} \
--env=DRONE_RPC_SECRET=58af6e764c227641e80ba91c4692bdd6 \
--env=DRONE_SERVER_HOST=10.19.83.10 \
--env=DRONE_SERVER_PROTO=http \
--name=drone \
--detach=true \
--publish=80:80 \
--publish=443:443 \
--restart=always  \
drone/drone:latest

Fedora


docker run \
--volume ${DRONE_HOME}/data:/data:Z \
--env=DRONE_AGENTS_ENABLED=true \
--env=DRONE_GITLAB_SERVER=https://academia.chorke.org/gitlab \
--env=DRONE_GITLAB_CLIENT_ID=${DRONE_GITLAB_CLIENT_ID:-c955d25b77a4fef47fb87cea0b2aba99} \
--env=DRONE_GITLAB_CLIENT_SECRET=${DRONE_GITLAB_CLIENT_SECRET:-ae74931239cc242bdddb063d2c4e1003} \
--env=DRONE_RPC_SECRET=58af6e764c227641e80ba91c4692bdd6 \
--env=DRONE_SERVER_HOST=10.19.83.10 \
--env=DRONE_SERVER_PROTO=http \
--name=drone \
--detach=true \
--publish=80:80 \
--publish=443:443 \
--restart=always  \
drone/drone:latest

Runner

Debian


docker run \
--detach=true \
--restart=always \
--publish=3000:3000 \
--name=drone-runner \
--env=DRONE_RPC_PROTO=http \
--env=DRONE_RUNNER_CAPACITY=2 \
--env=DRONE_RPC_HOST=10.19.83.10 \
--env=DRONE_RUNNER_NAME=drone-runner \
--env=DRONE_RPC_SECRET=58af6e764c227641e80ba91c4692bdd6 \
--volume=/var/run/docker.sock:/var/run/docker.sock \
drone/drone-runner-docker:latest

Fedora


docker run \
--detach=true \
--restart=always \
--publish=3000:3000 \
--name=drone-runner \
--env=DRONE_RPC_PROTO=http \
--env=DRONE_RUNNER_CAPACITY=2 \
--env=DRONE_RPC_HOST=10.19.83.10 \
--env=DRONE_RUNNER_NAME=drone-runner \
--env=DRONE_RPC_SECRET=58af6e764c227641e80ba91c4692bdd6 \
--volume=/var/run/docker.sock:/var/run/docker.sock:Z \
drone/drone-runner-docker:latest

Drone CLI

cat <<-'EOF' | sudo su
mkdir -p /opt/cli/drone-linux-amd64/bin/
wget -qO- https://github.com/harness/drone-cli/releases/latest/download/\
drone_linux_amd64.tar.gz | tar -xzf - -C /opt/cli/drone-linux-amd64/bin/

chmod +x /opt/cli/drone-linux-amd64/bin/drone
update-alternatives --install /usr/local/bin/drone drone \
 /opt/cli/drone-linux-amd64/bin/drone 1980
EOF

Playground

mkdir -p ~/Documents/drone-playground/
      cd ~/Documents/drone-playground/
export DRONE_TOKEN=yClIwgxje1hmP7bLSr1Y3vilNgS1ANyG
export DRONE_SERVER=https://cdn.chorke.org
drone user info chorke.academia
drone user ls

drone build ls chorke/academia-core-utility
drone build ls -h
drone registry ls chorke/academia-core-utility
drone registry ls -h
drone secret ls chorke/academia-core-utility
drone secret ls -h

drone deploy -h
drone cron -h
drone exec -h
drone repo -h
drone sign -h
drone secret add \
 -repository chorke/academia-core-utility \
 -data @./cdn.chorke.org/id_ed25519 \
 -name SSH_PRIVATE_KEY \
 -allow-pull-request
drone secret add \
 -repository chorke/academia-core-utility \
 -data '[email protected]' \
 -name DEPLOY_HOST \
 -allow-pull-request

drone secret ls \
 -repository chorke/academia-core-utility
drone orgsecret ls
drone secret rm \
 -repository chorke/academia-core-utility \
 -name SSH_PRIVATE_KEY


Knowledge

sudo ss -tulwn | grep LISTEN
sudo ss -tulpn | grep LISTEN
sudo ss -tulpn | grep LISTEN | grep sshd
sudo ss -tulpn | grep LISTEN | grep minio
sudo ss -tulpn | grep LISTEN | grep resolve
sudo lsof -i -P -n | grep 
openssl rand -hex 16

References