Skip to content

Commit 313c811

Browse files
added rocker.chat-20-04
1 parent 80519df commit 313c811

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 "
18+
##################################################################################################################################################################
19+
Rocket.Chat is the leading open source team chat software solution. Free, unlimited and completely customizable with on-premises and SaaS cloud hosting.
20+
Replace email, HipChat & Slack with the ultimate team chat software solution.
21+
22+
This Rocket.Chat image uses docker under the hood. To learn more, please read our docker documentation - https://docs.rocket.chat/deploy/prepare-for-your-deployment/rapid-deployment-methods/docker-and-docker-compose
23+
24+
You can find the compose project in $HOME/rocketchat directory.
25+
26+
Looking for how to use Rocket.Chat? Be sure to check our docs: https://docs.rocket.chat
27+
Need some help? Join our community forums https://forums.rocket.chat and https://open.rocket.chat
28+
##################################################################################################################################################################
29+
"
30+
echo
31+
echo
32+
echo -e "${RED}You can access the Rocker.Chat Admin UI using the below URL in your browser.${NC}"
33+
echo -e "${RED}http://\$IPADDRESS:3000${NC}"
34+
echo
35+
36+
37+
#Cleanup script
38+
rm -rf /usr/local/src/
39+
mkdir -p /usr/local/src/
40+
rm -rf /var/lib/cloud/instances/*
41+
rm -rf /var/lib/cloud/data/*
42+
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \; >/dev/null 2>&1
43+
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
44+
cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp
45+
apt-get -y autoremove >/dev/null 2>&1
46+
apt-get -y autoclean >/dev/null 2>&1
47+
history -c
48+
cat /dev/null > /root/.bash_history
49+
unset HISTFILE
50+
51+
rm -rf /root/.bashrc
52+
cp /etc/skel/.bashrc /root

rocket-chat-20-04/rocket-chat.sh

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

rocket-chat-20-04/rocket-chat.yaml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
- name: Rocker.Chat 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: Download file for docker and docker compose
12+
ansible.builtin.get_url:
13+
url: https://get.docker.com
14+
dest: /usr/local/src/docker.sh
15+
mode: '0755'
16+
17+
- name: Installing docker and docker compose
18+
shell: /usr/local/src/docker.sh
19+
20+
- name: Download compose file for Installing rocker chat
21+
ansible.builtin.get_url:
22+
url: https://raw.githubusercontent.com/RocketChat/Docker.Official.Image/master/compose.yml
23+
dest: /root/compose.yml
24+
25+
- name: Modifying the configuration
26+
replace:
27+
path: /root/compose.yml
28+
regexp: 'restart: always'
29+
replace: 'restart: on-failure'
30+
31+
- name: GetIP of the instance
32+
shell: curl ifconfig.me
33+
register: ip_out
34+
35+
- debug:
36+
var: ip_out.stdout
37+
38+
- name: Creating a directory for rockerchat
39+
ansible.builtin.file:
40+
path: /root/rocketchat
41+
state: directory
42+
43+
- name: Adding IP to a file
44+
ansible.builtin.lineinfile:
45+
path: /root/rocketchat/.env
46+
line: ROOT_URL=http://{{ip_out.stdout}}:3000
47+
create: yes
48+
49+
- name: Installing rocketchat
50+
shell: docker compose --env-file /root/rocketchat/.env -f /root/compose.yml up -d
51+
register: docker_out
52+
53+
- name: Creating a directory for shell script
54+
ansible.builtin.file:
55+
path: /opt/cloudstack
56+
state: directory
57+
58+
- name: Copy files for shell script
59+
copy:
60+
src: "{{ item.confsrc }}"
61+
dest: "{{ item.confdest }}"
62+
with_items:
63+
- { confsrc: '/usr/local/src/rocket-chat-20-04/opt/cloudstack/rocket-chat-cleanup.sh', confdest: '/opt/cloudstack/'}
64+
65+
- name: Adding a line for shell script
66+
lineinfile:
67+
path: /root/.bashrc
68+
line: "chmod +x /opt/cloudstack/rocket-chat-cleanup.sh && /opt/cloudstack/rocket-chat-cleanup.sh"
69+
state: present
70+
71+
- name: Restarting sshd
72+
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)