-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·76 lines (71 loc) · 3.23 KB
/
test.sh
File metadata and controls
executable file
·76 lines (71 loc) · 3.23 KB
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
76
#!/bin/bash
set -eux -o pipefail
export PYTHONUNBUFFERED=1
if [ -f /etc/nginx/sites-enabled/default ]; then
sudo rm /etc/nginx/sites-enabled/default
sudo systemctl restart nginx
fi
REDIS_URL=redis://dummy python3 manage.py test
wget -nv -O - https://packagecloud.io/dokku/dokku/gpgkey | sudo apt-key add -
if [ ! -f /etc/apt/sources.list.d/dokku.list ]; then
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ noble main" | sudo tee /etc/apt/sources.list.d/dokku.list
sudo apt-get update
fi
echo dokku dokku/skip_key_file boolean true | sudo debconf-set-selections
if [ ! -f /usr/bin/dokku ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y dokku
fi
sudo dokku plugin:install-dependencies --core
if [ ! -f /usr/bin/dokku-daemon ]; then
if [ ! -d dokku-daemon-rs ]; then
git clone https://github.com/palfrey/dokku-daemon-rs
fi
curl -OL https://github.com/palfrey/dokku-daemon-rs/releases/download/v0.1.0/dokku-daemon-rs-linux-amd64
chmod +x dokku-daemon-rs-linux-amd64
sudo mv dokku-daemon-rs-linux-amd64 /usr/bin/dokku-daemon
(cd dokku-daemon-rs &&
sudo cp -f conf/dokku-daemon.service /etc/systemd/system/dokku-daemon.service &&
sudo mkdir -p /var/run/dokku-daemon &&
sudo systemctl daemon-reload &&
sudo systemctl start dokku-daemon
)
fi
(dokku plugin:list | grep redis) || sudo dokku plugin:install https://github.com/dokku/dokku-redis.git --committish 1.41.0 redis
(dokku plugin:list | grep postgres) || sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git --committish 1.43.0 postgres
(dokku plugin:list | grep letsencrypt) || sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git --committish 0.22.0 letsencrypt
dokku plugin:list
dokku letsencrypt:cron-job --add
(dokku apps:list | grep wharf) || dokku apps:create wharf
(dokku redis:list | grep wharf) || (dokku redis:create wharf && dokku redis:link wharf wharf)
(dokku postgres:list | grep wharf) || (dokku postgres:create wharf && dokku postgres:link wharf wharf)
(git remote | grep dokku) || git remote add dokku ssh://dokku@localhost/wharf
if [ ! -f ~/.ssh/id_rsa ]; then
yes y | ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa
fi
(dokku ssh-keys:list | grep travis) || sudo dokku ssh-keys:add travis ~/.ssh/id_rsa.pub
dokku ssh-keys:list
sudo chmod 600 /home/dokku/.ssh/authorized_keys
sudo chmod 700 /home/dokku/.ssh
KEY_DIR=`pwd`/keys
if [ ! -d $KEY_DIR ]; then
mkdir -p $KEY_DIR
fi
sudo chown dokku:dokku $KEY_DIR
(dokku storage:list wharf | grep dokku-daemon) || dokku storage:mount wharf /var/run/dokku-daemon/dokku-daemon.sock:/var/run/dokku-daemon/dokku-daemon.sock
(dokku storage:list wharf | grep ssh) || dokku storage:mount wharf $KEY_DIR:/root/.ssh
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -v" git push dokku HEAD:refs/heads/main
export WHARF_HOSTNAME=wharf.$(hostname --long)
sudo hostsed add 127.0.0.1 $WHARF_HOSTNAME
dokku ps:scale wharf celery=1
sudo docker ps
sudo apt-get install -y net-tools
sudo netstat -nlp
dokku domains:report
dokku proxy:report
dokku ports:report
python3 check_boot.py http://$WHARF_HOSTNAME
if [ ! -f $KEY_DIR/id_rsa ]; then
echo "Can't find keys in key dir"
ls $KEY_DIR
exit 1
fi