8000 FEAT: dweb cmd dev/prod switchable + gitea & drone http/https switchable · docker-web/docker-web@5aaa16e · GitHub
[go: up one dir, main page]

Skip to content

Commit 5aaa16e

Browse files
author
valere
committed
FEAT: dweb cmd dev/prod switchable + gitea & drone http/https switchable
1 parent 982f8f1 commit 5aaa16e

File tree

10 files changed

+52
-21
lines changed

10 files changed

+52
-21
lines changed

apps/drone/config.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
#!/bin/bash
33
export PORT="7725"
4-
export DOMAIN="$DOMAIN"
4+
export DOMAIN="drone.$MAIN_DOMAIN"
55
export DOMAIN_GITEA="git.$MAIN_DOMAIN"
66
export RPC_SECRET=""
7-
export GITEA_CLIENT_ID=""
8-
export GITEA_CLIENT_SECRET=""
9-
export PROTO="https"
7+
export GITEA_CLIENT_ID="3f7e2ba2-193a-4026-a889-3b4bf4d057b8"
8+
export GITEA_CLIENT_SECRET="zFzGSmmuPvORvH8FneD3R4t07z8oYHH31Fuq14v4ygU="
9+
export PROTO="http"
1010
export REDIRECTIONS=""

apps/drone/docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ services:
33
image: drone/drone:2.24
44
container_name: drone
55
restart: unless-stopped
6-
dns:
7-
- 8.8.8.8
8-
- gitea
6+
#uncomment-for-prod dns:
7+
#uncomment-for-prod - 8.8.8.8
8+
#uncomment-for-prod - gitea
99
logging:
1010
driver: "local"
1111
options:
@@ -34,20 +34,20 @@ services:
3434
image: drone/drone-runner-docker:1
3535
container_name: drone-runner
3636
restart: unless-stopped
37-
dns:
38-
- 8.8.8.8
39-
- gitea
37+
#uncomment-for-prod dns:
38+
#uncomment-for-prod - 8.8.8.8
39+
#uncomment-for-prod - gitea
4040
volumes:
4141
- /var/run/docker.sock:/var/run/docker.sock
42-
- $PATH_DOCKERWEB:$PATH_DOCKERWEB # CAUTION this need to be absolute path
42+
- $PATH_DOCKERWEB:$PATH_DOCKERWEB
4343
environment:
4444
DRONE_RPC_HOST: "${DOMAIN}"
4545
DRONE_RPC_PROTO: "${PROTO}"
4646
DRONE_RPC_SECRET: "${RPC_SECRET}"
4747
DRONE_RUNNER_CAPACITY: "4"
4848
DRONE_RUNNER_NAME: "runner-docker"
4949
DRONE_RUNNER_NETWORKS: "dockerweb"
50-
DRONE_RUNNER_VOLUMES: "$PATH_DOCKERWEB:$PATH_DOCKERWEB,/var/run/docker.sock:/var/run/docker.socks" # CAUTION this need to be absolute paths
50+
DRONE_RUNNER_VOLUMES: "$PATH_DOCKERWEB:$PATH_DOCKERWEB, /var/run/docker.sock:/var/run/docker.sock"
5151

5252
volumes:
5353
data:

apps/drone/pre-install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# switch between http / https
3+
[[ $MAIN_DOMAIN != "domain.local" ]] && sed -i "s|PROTO=.*|PROTO=\"https\"|g" "$PATH_DOCKERWEB_APPS/$1/config.sh"
4+
[[ $MAIN_DOMAIN != "domain.local" ]] && sed -i 's/#uncomment-for-prod //g' "$PATH_DOCKERWEB_APPS/$1/docker-compose.yml"

apps/gitea/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export PORT_SSH="7724"
77
export PORT_SSH_EXPOSED="22"
88
export PORT_DB="7723"
99
export POST_INSTALL_TEST_CMD="docker exec gitea gitea admin"
10-
export PROTO="https"
10+
export PROTO="http"
1111
export REDIRECTIONS=""

apps/gitea/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ services:
33
image: gitea/gitea:1.12.6
44
container_name: gitea
55
restart: unless-stopped
6+
#uncomment-for-prod dns:
7+
#uncomment-for-prod - 8.8.8.8
8+
#uncomment-for-prod - drone
69
depends_on:
710
- gitea-db
811
ports:

apps/gitea/pre-install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
sudo useradd git >/dev/null 2>&1
44
sudo chown -R git:git /home/git/
55

6-
# switch between http / https dev / prod
7-
[[ $MAIN_DOMAIN == "domain.local" ]] && sed -i "s|PROTO=.*|PROTO=\"https\"|g" "$PATH_DOCKERWEB_APPS/$1/config.sh"
6+
# switch between http / https
7+
[[ $MAIN_DOMAIN != "domain.local" ]] && sed -i "s|PROTO=.*|PROTO=\"https\"|g" "$PATH_DOCKERWEB_APPS/$1/config.sh"
8+
[[ $MAIN_DOMAIN != "domain.local" ]] && sed -i '/#uncomment-for-prod /d' $"$PATH_DOCKERWEB_APPS/$1/docker-compose.yml"
9+
810
sed -i "s|DOMAIN_GITEA=.*|DOMAIN_GITEA=\"$DOMAIN\"|g" "$PATH_DOCKERWEB_APPS/drone/config.sh"

src/alias.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/bin/bash
2-
alias docker-web='bash /var/docker-web/src/cli.sh $@'
3-
alias dweb='docker-web $@'
42

5-
alias docker-webdev='cp -R ~/docker-web/* /var/docker-web && bash /var/docker-web/src/cli.sh $@'
6-
alias dwebdev='docker-web $@'
3+
dwebalias() {
4+
if [ "$(basename "$PWD")" = "docker-web" ] # if we work/dev from a folder named 'docker-web'
5+
then
6+
cp -R ./* /var/docker-web # we should copy files to app in /var/docker-web
7+
fi
8+
bash /var/docker-web/src/cli.sh $@ # launch app with all params
9+
}
10+
11+
alias docker-web='dwebalias $@'
12+
alias dweb='dwebalias $@'

src/completion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ _docker-web() {
3131
return 0
3232
}
3333

34-
complete -F _docker-web docker-web dweb docker-webdev dwebdev
34+
complete -F _docker-web docker-web dweb

src/env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export DOCKERWEB_VERSION="24.8.8"
1+
export DOCKERWEB_VERSION="24.8.9"
22
export GITHUB_DOCKERWEB="https://github.com/docker-web/docker-web"
33
export PATH_DOCKERWEB=/var/docker-web
44
export PATH_DOCKERWEB_APPS=$PATH_DOCKERWEB/apps

template/.drone.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
kind: pipeline
2+
type: docker
3+
name: default
4+
5+
steps:
6+
- name: deploy
7+
image: docker:dind
8+
commands:
9+
- apk add --upgrade npm bash findutils rsync sed
10+
- WORKDIR="/var/docker-web/apps/$DRONE_REPO_NAME"
11+
- rm -rf $WORKDIR
12+
- mkdir $WORKDIR
13+
- rsync -av --exclude ./node_modules /drone/src/ $WORKDIR
14+
- cd $WORKDIR
15+
- npm ci
16+
- bash /var/docker-web/src/cli.sh up $DRONE_REPO_NAME

0 commit comments

Comments
 (0)
0