Updated README, added licence, and provide a vagrant file.

This commit is contained in:
Shuai Lin 2016-11-21 13:22:07 +08:00
parent 91b07750ee
commit 5b3bc6ca0c
4 changed files with 161 additions and 3 deletions

13
LICENSE.txt Normal file
View file

@ -0,0 +1,13 @@
Copyright (c) 2016 Seafile Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

114
README.md
View file

@ -1,3 +1,113 @@
## seafile-docker [![Build Status](https://secure.travis-ci.org/haiwen/seafile-docker.png?branch=master)](http://travis-ci.org/haiwen/seafile-docker) [![Build Status](https://secure.travis-ci.org/haiwen/seafile-docker.png?branch=master)](http://travis-ci.org/haiwen/seafile-docker)
Seafile Docker Image. ### About
- [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine.
- Docker makes it much easier to deploy [a Seafile server](https://github.com/haiwen/seafile) on your servers and keep it updated.
- The base image configures Seafile with the Seafile team's recommended optimal defaults.
### Getting Started
The simplest way to get started is via the **simple** template, which can be installed within servera minutes.
```
sudo git clone https://github.com/haiwen/seafile-docker.git /var/seafile/
cd /var/seafile/
sudo cp samples/server.conf bootstrap/bootstrap.conf
# Edit the options according to your use case
vim bootstrap/bootstrap.conf
sudo ./launcher bootstrap
sudo ./launcher start
```
### Directory Structure
#### `/bootstrap`
This directory is for container definitions for your Seafile containers. You are in charge of this directory, it ships empty.
#### `/samples`
Sample container definitions you may use to bootstrap your environment. You can copy templates from here into the bootstrap directory.
#### `/shared`
Placeholder spot for shared volumes. You may elect to store certain persistent information outside of a container, in our case we keep various logfiles and upload directory outside. This allows you to rebuild containers easily without losing important information.
- /shared/db: This is the data directory for mysql server
- /shared/seafile: This is the directory for seafile server configuration and data.
- /shared/logs: This is the directory for logs.
- /shared/logs/var-log: This is the directory that would be mounted as `/var/log` inside the container. For example, you can find the nginx logs in `shared/logs/var-log/nginx/`.
- /shared/logs/seafile: This is the directory that would contain the log files of seafile server processes. For example, you can find seaf-server logs in `shared/logs/seafile/seafile.log`.
#### `/templates`
Various jinja2 templates used for seafile server configuration.
#### `/image`
Dockerfiles for Seafile.
The Docker repository will always contain the latest built version at: https://hub.docker.com/r/seafileltd/server/, you should not need to build the base image.
### Launcher
The base directory contains a single bash script which is used to manage containers. You can use it to "bootstrap" a new container, enter, start, stop and destroy a container.
```
Usage: launcher COMMAND
Commands:
start: Start/initialize a container
stop: Stop a running container
restart: Restart a container
destroy: Stop and remove a container
enter: Use docker exec to enter a container
logs: Docker logs for container
memconfig: Configure sane defaults for available RAM
bootstrap: Bootstrap a container for the config based on a template
rebuild: Rebuild a container (destroy old, bootstrap, start new)
```
If the environment variable "SUPERVISED" is set to true, the container won't be detached, allowing a process monitoring tool to manage the restart behaviour of the container.
### Container Configuration
The beginning of the container definition can contain the following "special" sections:
#### port mapping:
```conf
server.port_mappings = 80:80,443:443
```
### Troubleshooting
View the container logs: `./launcher logs`
Spawn a shell inside your container using `./launcher enter`. This is the most foolproof method if you have host root access.
### Developing with Vagrant
If you are looking to make modifications to this repository, you can easily test
out your changes before committing, using the magic
of [Vagrant](http://vagrantup.com). Install Vagrant as
per
[the default instructions](http://docs.vagrantup.com/v2/installation/index.html),
and then run:
vagrant up
This will spawn a new Ubuntu VM, install Docker, and then await your
instructions. You can then SSH into the VM with `vagrant ssh`, become `root`
with `sudo -i`, and then you're right to go. Your live git repo is already
available at `/var/seafile`, so you can just `cd /var/seafile` and then start
running `launcher`.
License
===
Apache

35
Vagrantfile vendored Normal file
View file

@ -0,0 +1,35 @@
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 4
end
config.vm.define :dockerhost do |config|
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
if ENV["http_proxy"]
config.vm.provision "shell", inline: <<-EOF
echo "Acquire::http::Proxy \\"#{ENV['http_proxy']}\\";" >/etc/apt/apt.conf.d/50proxy
echo "http_proxy=\"#{ENV['http_proxy']}\"" >/etc/profile.d/http_proxy.sh
EOF
end
config.vm.provision "shell", inline: <<-EOF
set -e
export DEBIAN_FRONTEND=noninteractive
echo "en_US.UTF-8 UTF-8" >/etc/locale.gen
locale-gen
echo "Apt::Install-Recommends 'false';" >/etc/apt/apt.conf.d/02no-recommends
echo "Acquire::Languages { 'none' };" >/etc/apt/apt.conf.d/05no-languages
apt-get update
apt-get -y remove --purge puppet juju
apt-get -y autoremove --purge
wget -qO- https://get.docker.com/ | sh
ln -s /vagrant /var/seafile
EOF
end
end

View file

@ -104,4 +104,4 @@ admin.email = $admin_email
admin.password = $admin_passwd admin.password = $admin_passwd
EOF EOF
# ./launcher bootstrap && ./launcher start ./launcher bootstrap && ./launcher start