Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4256150ed4 | ||
|
|
758303acfd | ||
|
|
313677fcf2 |
@@ -0,0 +1,32 @@
|
|||||||
|
# Deploy drone CI system
|
||||||
|
|
||||||
|
services:
|
||||||
|
drone:
|
||||||
|
image: drone/drone:2
|
||||||
|
environment:
|
||||||
|
- DRONE_GITEA_SERVER=http://gitea.local
|
||||||
|
- DRONE_GITEA_CLIENT_ID=put_the_real_client_id_here
|
||||||
|
- DRONE_GITEA_CLIENT_SECRET=put_the_real_secret_here
|
||||||
|
- DRONE_RPC_SECRET=super-duper-secret
|
||||||
|
- DRONE_SERVER_HOST=gitea.local # TODO: make this more generic
|
||||||
|
- DRONE_SERVER_PROTO=http
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./drone:/data
|
||||||
|
ports:
|
||||||
|
- 80
|
||||||
|
- 443
|
||||||
|
|
||||||
|
drone-runner:
|
||||||
|
image: drone/drone-runner-docker:1
|
||||||
|
environment:
|
||||||
|
- DRONE_RPC_PROTO=http
|
||||||
|
- DRONE_RPC_HOST=drone
|
||||||
|
- DRONE_RPC_SECRET=super-duper-secret
|
||||||
|
- DRONE_RUNNER_CAPACITY=2
|
||||||
|
- DRONE_RUNNER_NAME=drone-runner-1
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
ports:
|
||||||
|
- 3000
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
mkdir -p ./drone
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
# TODO: remove version since it is now redundant
|
||||||
|
# remove this network definition unless there's a reason for it
|
||||||
networks:
|
networks:
|
||||||
gitea:
|
gitea:
|
||||||
external: false
|
external: false
|
||||||
|
|
||||||
services:
|
services:
|
||||||
server:
|
server:
|
||||||
image: gitea/gitea:1.19.0
|
image: gitea/gitea:1.18.3
|
||||||
environment:
|
environment:
|
||||||
- USER_UID=1000
|
- USER_UID=1000
|
||||||
- USER_GID=1000
|
- USER_GID=1000
|
||||||
@@ -18,7 +19,6 @@ services:
|
|||||||
- GITEA__server__HTTP_PORT=3000
|
- GITEA__server__HTTP_PORT=3000
|
||||||
- GITEA__server__LOCAL_ROOT_URL=http://gitea.local:3000/
|
- GITEA__server__LOCAL_ROOT_URL=http://gitea.local:3000/
|
||||||
- GITEA__server__ROOT_URL=http://gitea.local:3000/
|
- GITEA__server__ROOT_URL=http://gitea.local:3000/
|
||||||
- GITEA__actions__ENABLED=true
|
|
||||||
- GITEA__security__INSTALL_LOCK=true
|
- GITEA__security__INSTALL_LOCK=true
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
@@ -48,17 +48,3 @@ services:
|
|||||||
- gitea
|
- gitea
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres:/var/lib/postgresql/data
|
- ./postgres:/var/lib/postgresql/data
|
||||||
|
|
||||||
runner:
|
|
||||||
image: cerc/act-runner:local
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- GITEA_INSTANCE_INSECURE=1
|
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=eMdEwIzSo87nBh0UFWZlbp308j6TNWr3WhWxQqIc
|
|
||||||
- GITEA_INSTANCE_URL=http://host.docker.internal:3000
|
|
||||||
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://cerc/act_runner-task-executor:local,ubuntu-22.04:docker://cerc/act_runner-task-executor:local
|
|
||||||
networks:
|
|
||||||
- gitea
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- ./act_runner:/data
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ GITEA_USER_EMAIL=${GITEA_USER}@example.com
|
|||||||
GITEA_NEW_ORGANIZATION=cerc-io
|
GITEA_NEW_ORGANIZATION=cerc-io
|
||||||
GITEA_URL_PREFIX=http://localhost:3000
|
GITEA_URL_PREFIX=http://localhost:3000
|
||||||
CERC_GITEA_TOKEN_NAME=laconic-so-publication-token
|
CERC_GITEA_TOKEN_NAME=laconic-so-publication-token
|
||||||
CERC_GITEA_RUNNER_REGISTRATION_TOKEN=eMdEwIzSo87nBh0UFWZlbp308j6TNWr3WhWxQqIc
|
|
||||||
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
@@ -18,7 +17,8 @@ if [[ -z ${CERC_SO_COMPOSE_PROJECT} ]] ; then
|
|||||||
else
|
else
|
||||||
compose_command="docker compose -p ${CERC_SO_COMPOSE_PROJECT}"
|
compose_command="docker compose -p ${CERC_SO_COMPOSE_PROJECT}"
|
||||||
fi
|
fi
|
||||||
sleep 15
|
# HACK: sleep a bit because gitea may not be up yet (container reports it has started before service is available)
|
||||||
|
sleep 5
|
||||||
${compose_command} exec --user git server gitea admin user list --admin | grep -v -e "^ID" | awk '{ print $2 }' | grep ${GITEA_USER} > /dev/null
|
${compose_command} exec --user git server gitea admin user list --admin | grep -v -e "^ID" | awk '{ print $2 }' | grep ${GITEA_USER} > /dev/null
|
||||||
if [[ $? == 1 ]] ; then
|
if [[ $? == 1 ]] ; then
|
||||||
# Then create if it wasn't found
|
# Then create if it wasn't found
|
||||||
@@ -44,7 +44,7 @@ if [[ ${token_found} != 1 ]] ; then
|
|||||||
new_gitea_token=$( curl -s -X POST "${GITEA_URL_PREFIX}/api/v1/users/${GITEA_USER}/tokens" \
|
new_gitea_token=$( curl -s -X POST "${GITEA_URL_PREFIX}/api/v1/users/${GITEA_USER}/tokens" \
|
||||||
-u ${GITEA_USER}:${GITEA_PASSWORD} \
|
-u ${GITEA_USER}:${GITEA_PASSWORD} \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"name":"'${CERC_GITEA_TOKEN_NAME}'", "scopes": [ "sudo" ] }' \
|
-d '{"name":"'${CERC_GITEA_TOKEN_NAME}'"}' \
|
||||||
| jq -r .sha1 )
|
| jq -r .sha1 )
|
||||||
echo "This is your gitea access token: ${new_gitea_token}. Keep it safe and secure, it can not be fetched again from gitea."
|
echo "This is your gitea access token: ${new_gitea_token}. Keep it safe and secure, it can not be fetched again from gitea."
|
||||||
echo "To use with laconic-so set this environment variable: export CERC_NPM_AUTH_TOKEN=${new_gitea_token}"
|
echo "To use with laconic-so set this environment variable: export CERC_NPM_AUTH_TOKEN=${new_gitea_token}"
|
||||||
@@ -76,10 +76,5 @@ if [[ $? != 0 ]] ; then
|
|||||||
-d '{"username": "'${GITEA_NEW_ORGANIZATION}'"}' > /dev/null
|
-d '{"username": "'${GITEA_NEW_ORGANIZATION}'"}' > /dev/null
|
||||||
echo "Created the organization ${GITEA_NEW_ORGANIZATION}"
|
echo "Created the organization ${GITEA_NEW_ORGANIZATION}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Seed a token for act_runner registration.
|
|
||||||
docker compose -p ${CERC_SO_COMPOSE_PROJECT} exec db psql -U gitea -d gitea -c "INSERT INTO public.action_runner_token(token, owner_id, repo_id, is_active, created, updated, deleted) VALUES('${CERC_GITEA_RUNNER_REGISTRATION_TOKEN}', 0, 0, 'f', 1679000000, 1679000000, NULL);" >/dev/null
|
|
||||||
|
|
||||||
echo "Gitea was configured to use host name: gitea.local, ensure that this resolves to localhost, e.g. with sudo vi /etc/hosts"
|
echo "Gitea was configured to use host name: gitea.local, ensure that this resolves to localhost, e.g. with sudo vi /etc/hosts"
|
||||||
echo "Success, gitea is properly initialized"
|
echo "Success, gitea is properly initialized"
|
||||||
|
|||||||
@@ -4,4 +4,3 @@ if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
|||||||
fi
|
fi
|
||||||
mkdir -p ./gitea
|
mkdir -p ./gitea
|
||||||
mkdir -p ./gitea/ssh
|
mkdir -p ./gitea/ssh
|
||||||
mkdir -p ./act_runner
|
|
||||||
|
|||||||
Reference in New Issue
Block a user