Skip to content

Commit 15f4941

Browse files
committed
Add github action
Add github action Signed-off-by: Bensuperpc <[email protected]>
1 parent af4da4f commit 15f4941

File tree

3 files changed

+194
-7
lines changed

3 files changed

+194
-7
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: scripts
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'master'
8+
- 'dev'
9+
paths-ignore:
10+
- '**/README.md'
11+
pull_request:
12+
branches:
13+
- '*'
14+
schedule:
15+
- cron: '0 3 * * 1' # every monday at 7:00 https://crontab.guru/#0_7_*_*_1
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
name: scripts
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
matrix:
24+
os: [ubuntu-18.04, ubuntu-20.04]
25+
steps:
26+
- name: "📥 Checkout Code"
27+
uses: actions/[email protected]
28+
with:
29+
submodules: 'recursive'
30+
fetch-depth: 0
31+
- name: "🛠️ Install"
32+
run: yes Y | sudo ./install.sh
33+
- name: "🧹 Uninstall"
34+
run: yes n | sudo ./uninstall.sh

docker/container/rsync-docker.sh

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
set -e
3+
#//////////////////////////////////////////////////////////////
4+
#// ____ //
5+
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
6+
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
7+
#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ //
8+
#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| //
9+
#// |_| |_| //
10+
#//////////////////////////////////////////////////////////////
11+
#// //
12+
#// Script, 2021 //
13+
#// Created: 30, May, 2021 //
14+
#// Modified: 31, May, 2021 //
15+
#// file: - //
16+
#// - //
17+
#// Source: https://github.com/axiom-data-science/rsync-server //
18+
#// OS: ALL //
19+
#// CPU: ALL //
20+
#// //
21+
#//////////////////////////////////////////////////////////////
22+
23+
DOCKER_IMAGE=bensuperpc/rsync-server:latest
24+
25+
USERNAME_SIZE=16
26+
PASSWORD_SIZE=64
27+
28+
USERNAME=$(tr -dc A-Za-z </dev/urandom | head -c ${USERNAME_SIZE} ; echo '')
29+
PASSWORD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c ${PASSWORD_SIZE} ; echo '')
30+
31+
SSH_USERS=""
32+
RSYNC_USER=""
33+
USER_VOL_KEY=""
34+
35+
VOLUME_PATH="$PWD/data"
36+
37+
SSH_PORT=9000
38+
RSYNC_PORT=8000
39+
40+
for i in "$@"
41+
do
42+
case $i in
43+
-i=*|--image=*)
44+
DOCKER_IMAGE="${i#*=}"
45+
shift # past argument=value
46+
;;
47+
-v=*|--volumepath=*)
48+
VOLUME_PATH="${i#*=}"
49+
shift # past argument=value
50+
;;
51+
-p=*|--sshport=*)
52+
SSH_PORT="${i#*=}"
53+
shift # past argument=value
54+
;;
55+
-u=*|--user=*)
56+
SSH_USERS+="${i#*=} "
57+
shift # past argument=value
58+
;;
59+
-r=*|--rsyncuser=*)
60+
RSYNC_USER+="${i#*=} "
61+
shift # past argument=value
62+
;;
63+
-h|--help)
64+
echo "Usage: ${0##*/} [-u=<name1> -u=<name2> -p=<ssh port> -v=<volume_path> or nothing with default values]"
65+
exit 0
66+
;;
67+
*)
68+
# unknown option
69+
;;
70+
esac
71+
done
72+
73+
echo 'USERNAME Rsync (not Rsync + SSH):' ${USERNAME}
74+
echo 'PASSWORD Rsync (not Rsync + SSH):' ${PASSWORD}
75+
echo 'Usage ex 1: rsync -azv -e "ssh -i <Private key> -p '${SSH_PORT}' -l <USER>" localhost:/data/ $PWD'
76+
echo 'Usage ex 2: rsync -azv rsync://'${USERNAME}'@localhost:8000/volume/ $PWD'
77+
echo 'Replace <localhost> with <Your IP>'
78+
echo ''
79+
echo 'DOCKER_IMAGE:' ${DOCKER_IMAGE}
80+
echo 'VOLUME_PATH:' ${VOLUME_PATH}
81+
echo 'SSH_PORT:' ${SSH_PORT}
82+
echo 'RSYNC_PORT:' ${RSYNC_PORT} 'cannot be changed currently'
83+
echo 'SSH_USERS:' ${SSH_USERS}
84+
echo 'RSYNC_USER:' ${RSYNC_USER} 'cannot be changed currently'
85+
echo ''
86+
87+
setup_sshkey()
88+
{
89+
mkdir -p $PWD/.ssh
90+
if [ ! -f $PWD/.ssh/$1 ]; then
91+
ssh-keygen -o -a 256 -b 512 -t ed25519 -C "ed25519-key" -f $PWD/.ssh/$1 -q -N ""
92+
else
93+
echo 'File:' $1 'exist.'
94+
fi
95+
}
96+
97+
# Create multiple user
98+
for USER in $SSH_USERS; do
99+
setup_sshkey "$USER"
100+
USER_VOL_KEY+=" -v $PWD/.ssh/$USER.pub:/home/$USER/.ssh/authorized_keys"
101+
done
102+
103+
# Create root user
104+
setup_sshkey "root"
105+
106+
docker pull ${DOCKER_IMAGE}
107+
docker run \
108+
-v "${VOLUME_PATH}":/data \
109+
-e USERNAME=${USERNAME} \
110+
-e PASSWORD=${PASSWORD} \
111+
-e VOLUME=/data \
112+
-e ALLOW="*" \
113+
-e DENY="" \
114+
-v $PWD/.ssh/root.pub:/root/.ssh/authorized_keys \
115+
-e SSH_USERS="${SSH_USERS}" \
116+
-e RSYNC_USER="${RSYNC_USER}" \
117+
${USER_VOL_KEY} \
118+
-p ${SSH_PORT}:22 \
119+
-p ${RSYNC_PORT}:873 \
120+
${DOCKER_IMAGE}

docker/useful/pull_docker.sh

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
1-
sudo groupadd docker
2-
sudo usermod -aG docker $USER
3-
sudo systemctl enable docker
1+
#!/bin/bash
2+
set -e
3+
#//////////////////////////////////////////////////////////////
4+
#// ____ //
5+
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
6+
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
7+
#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ //
8+
#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| //
9+
#// |_| |_| //
10+
#//////////////////////////////////////////////////////////////
11+
#// //
12+
#// Script, 2021 //
13+
#// Created: 01, June, 2021 //
14+
#// Modified: 01, June, 2021 //
15+
#// file: - //
16+
#// - //
17+
#// Source: //
18+
#// OS: ALL //
19+
#// CPU: ALL //
20+
#// //
21+
#//////////////////////////////////////////////////////////////
22+
23+
docker pull debian:jessie
24+
docker pull debian:stretch
25+
docker pull debian:buster
26+
docker pull debian:bullseye
27+
docker pull debian:latest
28+
429
docker pull ubuntu:16.04
530
docker pull ubuntu:18.04
631
docker pull ubuntu:20.04
7-
docker pull ubuntu:20.10
832
docker pull ubuntu:latest
9-
docker pull gcc:latest
10-
docker pull tensorflow/tensorflow:latest
33+
34+
docker pull alpine:3.9
35+
docker pull alpine:3.10
36+
docker pull alpine:3.11
37+
docker pull alpine:3.12
38+
docker pull alpine:3.13
1139
docker pull alpine:latest
12-
docker pull python:latest
40+
41+
42+
#docker pull python:buster
43+
#docker pull python:latest
44+
#docker pull gcc:latest
45+
#docker pull tensorflow/tensorflow:latest

0 commit comments

Comments
 (0)