Skip to content

Commit d2e45b0

Browse files
rethinkdb-22-04
1 parent e004971 commit d2e45b0

File tree

3 files changed

+135
-0
lines changed

3 files changed

+135
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
RED='\033[1;31m'
4+
NC='\033[0m'
5+
6+
echo -e "${RED}
7+
################################################################################################################
8+
# Your MarketPlace App has been deployed successfully! #
9+
# Passwords are stored under /root/ #
10+
################################################################################################################
11+
${NC}"
12+
13+
echo
14+
echo -e "${RED}This message will be removed in the next login!${NC}"
15+
echo
16+
echo
17+
echo -e "${RED}Do NOT forget to configure your server before use! To secure RethinkDB follow
18+
the instructions described at https://rethinkdb.com/docs/security/.${NC}"
19+
echo
20+
echo -e "${RED}RethinkDB instance config: /etc/rethinkdb/instances.d/instance.conf
21+
RethinkDB log file: /var/log/rethinkdb${NC}"
22+
echo
23+
echo -e "${RED}You can view the RethinkDB Admin UI using the below URL in your browser.${NC}"
24+
echo -e "${RED}http://\$IPADDRESS:8000${NC}"
25+
echo
26+
27+
28+
#Cleanup script
29+
rm -rf /usr/local/src/
30+
mkdir -p /usr/local/src/
31+
rm -rf /var/lib/cloud/instances/*
32+
rm -rf /var/lib/cloud/data/*
33+
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \; >/dev/null 2>&1
34+
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
35+
cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp
36+
apt-get -y autoremove >/dev/null 2>&1
37+
apt-get -y autoclean >/dev/null 2>&1
38+
history -c
39+
cat /dev/null > /root/.bash_history
40+
unset HISTFILE
41+
42+
rm -rf /root/.bashrc
43+
cp /etc/skel/.bashrc /root

rethinkdb-22-04/rethinkdb.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
mkdir -p {/usr/local/src/rethinkdb-22-04/opt/cloudstack/,/usr/local/src/rethinkdb-22-04/}
4+
5+
cd /usr/local/src/rethinkdb-22-04/opt/cloudstack/ && wget https://raw.githubusercontent.com/stackbill/marketplace/main/_common-files/opt/cloudstack/rethinkdb-cleanup.sh
6+
7+
cd /usr/local/src/rethinkdb-22-04/ && wget https://raw.githubusercontent.com/stackbill/marketplace/main/rethinkdb-22-04/rethinkdb.yaml

rethinkdb-22-04/rethinkdb.yaml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
- name: RethinkDB Setup
2+
hosts: localhost
3+
tasks:
4+
- name: Restarting sshd
5+
shell: "sed -i 's/#Match User anoncvs/ForceCommand echo Please wait until the installation is completed..../g' /etc/ssh/sshd_config && systemctl restart sshd"
6+
7+
- name: Updating Packages
8+
ansible.builtin.apt:
9+
update_cache: yes
10+
11+
- name: Configuring packages for rethinkdb
12+
shell: "{{ item }}"
13+
with_items:
14+
- wget -qO- https://download.rethinkdb.com/repository/raw/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/rethinkdb-archive-keyrings.gpg
15+
- echo "deb [signed-by=/usr/share/keyrings/rethinkdb-archive-keyrings.gpg] https://download.rethinkdb.com/repository/ubuntu-$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
16+
17+
- name: Updating Packages
18+
ansible.builtin.apt:
19+
update_cache: yes
20+
21+
- name: Installing rethinkdb
22+
ansible.builtin.apt:
23+
name: rethinkdb
24+
state: present
25+
26+
- name: Copying the configuration file
27+
copy:
28+
src: /etc/rethinkdb/default.conf.sample
29+
dest: /etc/rethinkdb/instances.d/instance.conf
30+
remote_src: yes
31+
32+
- name: Modifying the configuration
33+
replace:
34+
path: /etc/rethinkdb/instances.d/instance.conf
35+
regexp: "{{ item.org }}"
36+
replace: "{{ item.rep }}"
37+
with_items:
38+
- { org: '# runuser=rethinkdb', rep: 'runuser=rethinkdb'}
39+
- { org: '# rungroup=rethinkdb', rep: 'rungroup=rethinkdb'}
40+
- { org: '# pid-file=/var/run/rethinkdb/rethinkdb.pid', rep: 'pid-file=/var/run/rethinkdb/rethinkdb.pid'}
41+
- { org: '# directory=/var/lib/rethinkdb/default', rep: 'directory=/var/lib/rethinkdb/default'}
42+
- { org: '# log-file=/var/log/rethinkdb', rep: 'log-file=/var/log/rethinkdb'}
43+
- { org: '# bind=127.0.0.1', rep: 'bind=all'}
44+
- { org: '# driver-port=28015', rep: 'driver-port=28015'}
45+
- { org: '# cluster-port=29015', rep: 'cluster-port=29015'}
46+
- { org: '# http-port=8080', rep: 'http-port=8080'}
47+
48+
- name: Creating a log file
49+
ansible.builtin.file:
50+
path: /var/log/rethinkdb
51+
state: touch
52+
owner: rethinkdb
53+
group: rethinkdb
54+
55+
- name: Enable services and start
56+
ansible.builtin.systemd:
57+
name: rethinkdb
58+
state: started
59+
enabled: true
60+
61+
- name: Restart rethinkdb
62+
service:
63+
name: rethinkdb
64+
state: restarted
65+
66+
- name: Creating a directory for shell script
67+
ansible.builtin.file:
68+
path: /opt/cloudstack
69+
state: directory
70+
71+
- name: Copy files for shell script
72+
copy:
73+
src: "{{ item.confsrc }}"
74+
dest: "{{ item.confdest }}"
75+
with_items:
76+
- { confsrc: '/usr/local/src/rethinkdb-22-04/opt/cloudstack/rethinkdb-cleanup.sh', confdest: '/opt/cloudstack/'}
77+
78+
- name: Adding a line for shell script
79+
lineinfile:
80+
path: /root/.bashrc
81+
line: "chmod +x /opt/cloudstack/rethinkdb-cleanup.sh && /opt/cloudstack/rethinkdb-cleanup.sh"
82+
state: present
83+
84+
- name: Restarting sshd
85+
shell: "sed -i 's/ForceCommand echo Please wait until the installation is completed..../#Match User anoncvs/g' /etc/ssh/sshd_config && systemctl restart sshd"

0 commit comments

Comments
 (0)