Skip to content

htfy96/mirror-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SJTUG mirror docker, based on tunasync/jekyll

Preparations

Follow these steps before building the images.

Prepare tunasync tar ball

Prepare a gzipped tunasync tar ball without version directory (as if generated by git archive without --prefix), rename it to tunasync.tar.gz, and place it into tunasync/.

You may run

$ cd tunasync
$ ../utils/genpack.sh tunasync

to generate it automatically.

Generate static mirror-web pages

Suppose the static web contents are supposed to store in /home/mirror-web.

Fetch the latest mirror-web and build the pages. You should have working jekyll installed.

$ utils/genpack.sh mirror-web # may generate an extra .tar.gz, just ignore it
$ cd mirror-web
$ jekyll build -d /home/mirror-web/_site

Note that the actual content is stored in the subdir _site.

You may also build the pages elsewhere and deploy them in the server.

Acquire key suite from let's encrypt

The configuration of nginx in this project requires key suite to support HTTPS.

Key suite could be acquired from let's encrypt for free through acme.sh client.

After your site became accessible from your domain, acquire_cert.sh provides a convinient way to get key suite. If not, please refer to https://github.com/Neilpang/acme.sh#use-standalone-server-to-issue-cert for steps.

source acquire_cert.sh your_website your_site_root

After this step, key suite should be placed under ~/.acme.sh/your_website/.

Build and run

There are two ways to build an run, the manual way and the docker-compose way. The latter is recommended.

Build and run manually

Build tunasync and nginx docker images

$ utils/prepare.sh

NOTE: after renewal of your key suite please run this step again to use the latest version.

Run docker containers

Suppose the static web contents are stored in /home/mirror-web, and the super-massive mirror filesystem is /home/mirrors. The mounting point in docker containers are /mnt/mirror-web and /mnt/mirrors respectively.

$ docker run --name mirrors_tunasync -d \
	-v /home/mirrors:/mnt/mirrors:Z \
	-v /home/mirror-web:/mnt/mirror-web:Z \
	sjtug/mirror-tunasync

$ docker run --name mirrors_nginx -d -p 80:80 \
	-v /home/mirrors:/mnt/mirrors:Z \
	-v /home/mirror-web:/mnt/mirror-web:Z \
	sjtug/mirror-nginx

Use docker-compose

After preparation, configure storage volume path in docker-compose.yml, then simply run

$ docker-compose -p sjtug up -d

Development

Discussions and pull requests are strongly encouraged.

LICENSE

GPLv3, except for files with specifications.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

About

Dockerfile for SJTUG mirror

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nginx 56.0%
  • Shell 44.0%