/ TECHNOLOGY

도커로 owncloud 설치하기

owncloud with docker

1. Install

sudu apt-get install docker.io

2. Run

sudo docker run -d -p 8080:80 -v /home/somewhere:/var/www/html/data --name="tigim_cloud" owncloud

-d : 백그라운드 실행. (Foreground옵션은 -i?)

-p : Linux 8080포트 - 컨테이너 80번 포트를 연결

-v : 도커 내부의 /var/www/html/data와 도커 외부의 /home/somewhere을 연결. /var/www/html/data는 owncloud에 업로드된 모든 물리적 데이터가 저장

-name : 컨테이너의 이름

Nginx + HTTPS와 연동 할 예정이므로, 외부 port는 그냥 냅뒀다. 아니면, 8080포트 대신, 80포트를 이용해야 외부 접근이 용이.

3. Auto-Run when booting

I don’t need this feature yet~ :)

4. NginX + ufw

#!/bin/bash

# change host name
hostname $1
echo $1 > /etc/hostname
sed -i 's/debian/$1/g' /etc/hosts

# install necessary packages
apt-get install -y nginx ufw

# configure ufw
ufw disable
ufw default deny incoming
ufw default allow outgoing
ufw allow 80  
ufw allow 443  
ufw allow 22  
ufw enable  

5. NginX Setting

To solve the error when uploading bigger than 1M file, Add following line to http{..} block in nginx config:

http {
	#...
    client_max_body_size 512m;
	#...
}

letsencrypt

Make sure that 80 port has to be open.

add a sub-domain (rm -rf ./* in /etc/letsencrypt/archive, /etc/letsencrypt/live, and /etc/letsencrypt/renewal first)

sudo letsencrypt certonly --expand -d tigiminsight.com -d cloud.tigiminsight.com -d music.tigiminsight.com -d torrent.tigiminsight.com 

3. ETC

When you immigrate your data or files from other system, you need to update your database like below.

sudo docker exec -u www-data tigim_cloud php occ files:scan --all  

Reference