|
| 1 | ++++ |
| 2 | +title = "Ditching Gdrive for Seafile" |
| 3 | +date = 2024-10-31 |
| 4 | + |
| 5 | +[taxonomies] |
| 6 | + tags = ["internet-freedom", "guide"] |
| 7 | +[extra] |
| 8 | + toc = true |
| 9 | ++++ |
| 10 | + |
| 11 | +## [Overview](#overview) |
| 12 | + |
| 13 | +I've always used cloud storage apps like Google Drive, Dropbox, etc. because it was always a hassle to work with documents and other files on-the-go. It was simple and convienient. But, eventually it kept getting annoying realising that now all these documents can now be accessed by some other company, and they aren't completely under my control. It felt like freedom was being traded for convienence. |
| 14 | + |
| 15 | +So, Recently I spent sometime looking for alternatives and I found a few like NextCloud, Syncthing, OwnCloud, SeaFile, etc.. I've read about and tested a few of these. |
| 16 | + |
| 17 | +- *Syncthing*: It's good, It works, and has good features for syncing files, but not really what I needed. |
| 18 | +- *NextCloud*: It was a bit too much to setup, but It comes with a lot of features that can be installed. But, It was too many features I wouldn't use. |
| 19 | +- *SeaFile*: It is simple, really easy to setup with docker and I chose to use this. |
| 20 | + |
| 21 | +Before learning to setup, Here are the Specs of the VPS, I tested this on: |
| 22 | + |
| 23 | +- *RAM*: 1GB |
| 24 | +- *STORAGE* 25GB SSD |
| 25 | +- *CPU*: Intel Xeon (Cascadelake) (1) @ 2.992GHz (1vCPU) |
| 26 | +- *OS*: Debian 12 x64 |
| 27 | + |
| 28 | +## [A Simple Setup](#setup) |
| 29 | + |
| 30 | +A simple SeaFile setup with Docker Compose... |
| 31 | + |
| 32 | +> **_NOTE:_** Make sure you have a "*seafile.example.com*" subdomain pointing to your VPS. |
| 33 | +
|
| 34 | +1. Install and setup Docker |
| 35 | + |
| 36 | +```sh |
| 37 | +# Prerequistes |
| 38 | +sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y |
| 39 | + |
| 40 | +# Docker GPG Key |
| 41 | +curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add - |
| 42 | + |
| 43 | +# Add Docker software repository |
| 44 | +sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable" |
| 45 | + |
| 46 | +# Install Docker |
| 47 | +sudo apt install docker-ce docker-compose containerd.io -y |
| 48 | + |
| 49 | +# Start Docker Service |
| 50 | +sudo systemctl enable docker && sudo systemctl start docker |
| 51 | + |
| 52 | +# Add User to Docker group |
| 53 | +sudo usermod -aG docker $USER && su - $USER |
| 54 | +``` |
| 55 | +2. Setting Up Seafile |
| 56 | + |
| 57 | +```sh |
| 58 | +# Create Seafile Directory |
| 59 | +mkdir /opt/seafile |
| 60 | +cd /opt/seafile |
| 61 | + |
| 62 | +# Get Seafile `docker-compose.yml` file (Seafile CE 11.0) |
| 63 | +wget -O "docker-compose.yml" "https://manual.seafile.com/11.0/docker/docker-compose/ce/11.0/docker-compose.yml" |
| 64 | +``` |
| 65 | + |
| 66 | +3. Edit Seafile `docker-compose.yml` file |
| 67 | + |
| 68 | +Make sure to update these variables in the file: |
| 69 | + |
| 70 | +- MYSQL_ROOT_PASSWORD |
| 71 | +- DB_ROOT_PASSWD |
| 72 | +- SEAFILE_ADMIN_EMAIL |
| 73 | +- SEAFILE_ADMIN_PASSWORD |
| 74 | +- SEAFILE_SERVER_HOSTNAME |
| 75 | + |
| 76 | +Rest can be left to defaults or changed as shown below. I've made a few adjustments to memory due to memory limitations. Hence, change as required. |
| 77 | + |
| 78 | +```sh |
| 79 | +services: |
| 80 | + db: |
| 81 | + image: mariadb:10.11 |
| 82 | + container_name: seafile-mysql |
| 83 | + environment: |
| 84 | + - MYSQL_ROOT_PASSWORD=YOUR_DB_PASS_HERE # Set the root's password of MySQL service. |
| 85 | + - MYSQL_LOG_CONSOLE=true |
| 86 | + - MARIADB_AUTO_UPGRADE=1 |
| 87 | + volumes: |
| 88 | + - /opt/seafile-mysql/db:/var/lib/mysql |
| 89 | + networks: |
| 90 | + - seafile-net |
| 91 | + deploy: |
| 92 | + resources: |
| 93 | + limits: |
| 94 | + memory: 128M # Update based on your memory limit |
| 95 | + |
| 96 | + memcached: |
| 97 | + image: memcached:1.6.18 |
| 98 | + container_name: seafile-memcached |
| 99 | + entrypoint: memcached -m 64 # Leave default, Set to 64 if you have low RAM |
| 100 | + networks: |
| 101 | + - seafile-net |
| 102 | + |
| 103 | + seafile: |
| 104 | + image: seafileltd/seafile-mc:11.0-latest |
| 105 | + container_name: seafile |
| 106 | + ports: |
| 107 | + - "80:80" |
| 108 | + - "443:443" # Comment Out if you don't require HTTPS (better to have HTTPS) |
| 109 | + volumes: |
| 110 | + - /opt/seafile-data:/shared |
| 111 | + environment: |
| 112 | + - DB_HOST=db |
| 113 | + - DB_ROOT_PASSWD=YOUR_DB_PASS_HERE # Should be root's password of MySQL service. |
| 114 | + - TIME_ZONE=Etc/UTC # Optional, default is UTC. |
| 115 | + - SEAFILE_ADMIN_EMAIL=YOUR_EMAIL_HERE |
| 116 | + - SEAFILE_ADMIN_PASSWORD=YOUR_SEAFILE_PASS_HERE |
| 117 | + - SEAFILE_SERVER_LETSENCRYPT=true # Use HTTPS or not |
| 118 | + - SEAFILE_SERVER_HOSTNAME=seafile.example.com # Specifies your host name if https |
| 119 | + depends_on: |
| 120 | + - db |
| 121 | + - memcached |
| 122 | + networks: |
| 123 | + - seafile-net |
| 124 | + deploy: |
| 125 | + resources: |
| 126 | + limits: |
| 127 | + memory: 256M # Increase if you have more memory |
| 128 | + |
| 129 | +networks: |
| 130 | + seafile-net: |
| 131 | +``` |
| 132 | + |
| 133 | +4. Running Seafile Server |
| 134 | + |
| 135 | +```sh |
| 136 | +# if `docker-compose.yml` file is in current directory |
| 137 | +docker compose up -d |
| 138 | + |
| 139 | +# if `docker-compose.yml` file is elsewhere |
| 140 | +docker compose -f /path/to/docker-compose.yml up -d |
| 141 | +``` |
| 142 | + |
| 143 | +5. Stats Check |
| 144 | + |
| 145 | +```sh |
| 146 | +# To check running containers |
| 147 | +docker ps |
| 148 | + |
| 149 | +# To check stats of containers |
| 150 | +docker stats |
| 151 | +``` |
| 152 | + |
| 153 | +You can now tweak the memory limits based on stats. |
| 154 | + |
| 155 | +you can refer to [Seafile Manual](https://manual.seafile.com/11.0/docker/deploy_seafile_with_docker/) for more information. |
| 156 | + |
| 157 | +## [Post Setup and Conclusion](#postsetup) |
| 158 | + |
| 159 | +In this article, we went through a simple Seafile Setup on a VPS. |
| 160 | + |
| 161 | +- You can access Seafile at *https://seafile.example.com*. |
| 162 | +- You can Login with SEAFILE_ADMIN_EMAIL and SEAFILE_ADMIN_PASSWORD from the `docker-compose.yml` file. |
| 163 | + |
| 164 | +After Login, You can: |
| 165 | + |
| 166 | +- Customize the frontend of Seafile. |
| 167 | +- Use it to store, edit and do other operations with files. |
| 168 | +- Download the Mobile app and connect to the same account. |
| 169 | +- And many more! |
| 170 | + |
| 171 | +That's it, Bye! |
0 commit comments