-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_dev.sh
75 lines (69 loc) · 2.87 KB
/
prepare_dev.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/bash
# Usage: bash prepare_dev.sh <db_postgres_password>
# install necessary packages
sudo apt-get update
sudo apt-get install -y postgresql postgresql-client openjdk-17-jdk-headless maven git openssh-server
if ! command -v redis-cli; then
sudo apt-get install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get install redis
fi
# init the database
sudo su -c 'psql -c "DROP DATABASE IF EXISTS gcs_dev;"' postgres
sudo su -c 'psql -c "CREATE DATABASE gcs_dev;"' postgres
bash database/database_deploy.sh postgres gcs_dev localhost 5432 "$1"
# configure gitolite
sudo userdel -r git
sudo useradd -m git
sudo su -c 'git clone https://github.com/sitaramc/gitolite /home/git/gitolite' git
sudo su -c 'mkdir -p /home/git/bin; /home/git/gitolite/install -to /home/git/bin' git
sudo cp /home/"$USER"/.ssh/id_rsa.pub /home/git/"$USER".pub
sudo chown git:git /home/git/"$USER".pub
sudo su -c "/home/git/bin/gitolite setup -pk /home/git/$USER.pub" git
rm -rf /home/"$USER"/gitolite-admin
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no' git clone \
ssh://git@localhost:22/gitolite-admin /home/"$USER"/gitolite-admin
mkdir -p /home/"$USER"/gitolite-admin/conf/gitolite.d/user
mkdir -p /home/"$USER"/gitolite-admin/conf/gitolite.d/repository
echo "
repo gitolite-admin
RW+ = $USER
repo testing
R = @all
include \"gitolite.d/user/*.conf\"
include \"gitolite.d/repository/*.conf\"
@all_public_repo =
repo @all_public_repo
R = @all" > /home/"$USER"/gitolite-admin/conf/gitolite.conf
git -C /home/"$USER"/gitolite-admin add conf/gitolite.conf
git -C /home/"$USER"/gitolite-admin commit -m "Init the gitolite-admin"
git -C /home/"$USER"/gitolite-admin push
echo "$USER ALL=(git) NOPASSWD: /usr/bin/rm" | sudo tee /etc/sudoers.d/gcs_dev
echo "
spring.datasource.druid.username=postgres
spring.datasource.druid.password=$1
spring.datasource.druid.url=jdbc:postgresql://localhost:5432/gcs_dev
spring.datasource.druid.stat-view-servlet.login-username=druid
spring.datasource.druid.stat-view-servlet.login-password=druid
spring.profiles.active=dev
git.server.domain=localhost
git.server.port=22
git.user.name=git
git.home.directory=/home/git
md5.salt=Is that the best you can do?
front-end.url=
spring.mvc.static-path-pattern=
spring.resources.static-locations=
gitolite.admin.repository.path=/home/$USER/gitolite-admin
spring.redis.host=localhost
spring.redis.port=6379
spring.mail.default-encoding=UTF-8
spring.mail.protocol=
spring.mail.host=
spring.mail.port=
spring.mail.username=
spring.mail.password=
" > src/main/resources/application.properties