Browse Source

Update readme

Artem Smirnov 7 months ago
parent
commit
ebded71239
1 changed files with 81 additions and 121 deletions
  1. 81
    121
      README.md

+ 81
- 121
README.md View File

@@ -4,163 +4,123 @@ Author:   Artem Smirnov, Bryan Hong
4 4
 Date:     September 13, 2018
5 5
 License:  Apache License, Version 2.0
6 6
 ---
7
-docker-aptly
8
-==
7
+# docker-aptly
9 8
 
10
-aptly in a container backed by nginx
9
+**docker-aptly** is container w `aptly` backed by `nginx`.
11 10
 
12
->aptly is a swiss army knife for Debian repository management: it allows you to mirror remote repositories, manage local package repositories, take snapshots, pull new versions of packages along with dependencies, publish as Debian repository. [aptly.info](http://aptly.info)
11
+**aptly** is a swiss army knife for Debian repository management: it allow you to mirror remote repositories, manage local package repositories, take snapshots, pull new versions of packages along with dependencies, publish as Debian repository. More info are on [aptly.info](http://aptly.info) and on [github](https://github.com/aptly-dev/aptly).
13 12
 
14
->nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP proxy server, originally written by Igor Sysoev [nginx.org](http://nginx.org/en/)
13
+**nginx** is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP proxy server, originally written by Igor Sysoev. More info is on [nginx.org](http://nginx.org/en/).
15 14
 
16
-**NOTE:** This container and the scripts within are written to make hosting an Ubuntu mirror "as-close-to-turnkey" as possible. If you want to host a Debian mirror, you'll need to build the image yourself, see [Building the Container](#building-the-container) below
15
+## Quickstart
17 16
 
18
-Quickstart
19
---
17
+The following command will run `aptly` and `nginx` in a container:
20 18
 
21
-The following command will run aptly and nginx in a container, if you want to customize or build the container locally, skip to [Building the Container](#building-the-container) below
22
-
23
-```
24
-docker run                                               \
25
-  --detach=true                                          \
26
-  --log-driver=syslog                                    \
27
-  --name="aptly"                                         \
28
-  --restart=always                                       \
29
-  --env FULL_NAME="First Last"                           \
30
-  --env EMAIL_ADDRESS="youremail@example.com"            \
31
-  --env GPG_PASSWORD="PickAPassword"                     \
32
-  --env HOSTNAME=aptly.example.com                       \
33
-  --volume /dockerhost/dir/with/lots/of/space:/opt/aptly \
34
-  --publish 80:80                                        \
35
-  bryanhong/aptly:latest
19
+```bash
20
+docker run \
21
+  --detach=true \
22
+  --log-driver=syslog \
23
+  --restart=always \
24
+  --name="aptly" \
25
+  --publish 80:80 \
26
+  --volume $(pwd)/aptly_files:/opt/aptly \
27
+  --env FULL_NAME="First Last" \
28
+  --env EMAIL_ADDRESS="youremail@example.com" \
29
+  --env GPG_PASSWORD="PickAPassword" \
30
+  --env HOSTNAME=aptly.example.com \
31
+  smirart/aptly:latest
36 32
 ```
37 33
 
38
-### Runtime flags explained
34
+> Wait until the GPG keyrings are created (not 0 bytes) before proceeding (it can take a few minutes). They will be in the bind mount location.
39 35
 
40
-```
41
---detach=true
42
-```  
43
-run the container in the background  
44
-```
45
---log-driver=syslog
46
-```  
47
-send nginx logs to syslog on the Docker host  (requires Docker 1.6 or higher)  
48
-```
49
---name="aptly"
50
-```  
51
-name of the container  
52
-```
53
---restart=always
54
-```  
55
-automatically start the container when the Docker daemon starts  
56
-```
57
---env FULL_NAME="First Last"
58
-```  
59
-the first and last name that will be associated with the GPG apt signing key  
60
-```
61
---env EMAIL_ADDRESS="youremail@example.com"
62
-```  
63
-the email address that will be associated with the GPG apt signing key  
64
-```
65
---env GPG_PASSWORD="PickAPassword"
66
-```  
67
-the password that will be used to encrypt the GPG apt signing key  
68
-```
69
---env HOSTNAME=aptly.example.com
70
-```  
71
-the hostname of the Docker host that this container is running on  
72
-```
73
---volume /dockerhost/dir/with/lots/of/space:/opt/aptly
74
-```  
75
-path that aptly will use to store its data : mapped path in the container  
76
-```
77
---publish 80:80
78
-```  
79
-Docker host port : mapped port in the container
80
-
81
-Create a mirror of Ubuntu's main repository
82
---
83
-1. The initial download of the repository may take quite some time depending on your bandwidth limits, it may be in your best interest to open a screen or tmux session before proceeding.
84
-2. Attach to the container ```docker exec -it aptly /bin/bash```
85
-3. By default, ```/opt/update_mirror.sh``` will automate the creation of an Ubuntu 14.04 Trusty repository with the main and universe components, you can adjust the variables in the script to suit your needs.
86
-4. Run ```/opt/update_mirror.sh```
87
-5. If the script fails due to network disconnects etc, just re-run it.
36
+### Explane of the flags
88 37
 
89
-When the script completes, you should have a functional mirror that you can point a client to.
38
+Flag | Description
39
+--- | ---
40
+`--detach=true` | Run the container in the background
41
+`--log-driver=syslog` | Send nginx logs to syslog on the Docker host  (requires Docker 1.6 or higher)
42
+`--restart=always` | Automatically start the container when the Docker daemon starts
43
+`--name="aptly"` | Name of the container
44
+`--volume $(pwd)/aptly:/opt/aptly` | Path that aptly will use to store its data : mapped path in the container
45
+`--publish 80:80` | Docker host port : mapped port in the container
46
+`--env FULL_NAME="First Last"` | The first and last name that will be associated with the GPG apt signing key
47
+`--env EMAIL_ADDRESS="your@email.com"` | The email address that will be associated with the GPG apt signing key
48
+`--env GPG_PASSWORD="PickAPassword"` | The password that will be used to encrypt the GPG apt signing key
49
+`--env HOSTNAME=aptly.example.com` | The hostname of the Docker host that this container is running on
90 50
 
91
-Point a host at the mirror
92
---
51
+## Setup a client for use your repo
93 52
 
94 53
 1. Fetch the public PGP key from your aptly repository and add it to your trusted repositories
95 54
 
96
- ```
97
- wget http://FQDN.OF.APTLY/aptly_repo_signing.key
98
- apt-key add aptly_repo_signing.key
99
- ```
55
+    ```bash
56
+    wget http://YOUR_HOST_FOR_APTLY/aptly_repo_signing.key
57
+    apt-key add aptly_repo_signing.key
58
+    ```
100 59
 
101 60
 2. Backup then replace /etc/apt/sources.list
102 61
 
103
- ```
104
- cp /etc/apt/sources.list /etc/apt/sources.list.bak
105
- echo "deb http://FQDN.OF.APTLY/ ubuntu main" > /etc/apt/sources.list
106
- apt-get update
107
- ```
108
- 
109
- You should be able to install packages at this point!
110
- 
111
-Checkout the excellent aptly documentation [here](http://www.aptly.info/doc/overview/)
62
+    ```bash
63
+    cp /etc/apt/sources.list /etc/apt/sources.list.bak
64
+    echo "deb http://YOUR_HOST_FOR_APTLY/ ubuntu main" > /etc/apt/sources.list
65
+    apt-get update
66
+    ```
112 67
 
113
-Building the container
114
---
68
+    > `ubuntu` & `main` may be another. It's require from your repos on aptly.
115 69
 
116
-If you want to make modifications to the image or simply see how things work, check out this repository:
70
+## Configure the container
117 71
 
72
+For attach to the container and start to configure your aptly use:
73
+
74
+```bash
75
+docker exec -it aptly /bin/bash
118 76
 ```
119
-git clone https://github.com/bryanhong/docker-aptly.git
77
+
78
+Read [the official documentation](https://www.aptly.info/doc/overview/) for learn more about aptly.
79
+
80
+For stop container use:
81
+
82
+```bash
83
+docker stop aptly
120 84
 ```
121 85
 
122
-### Commands and variables
86
+### Create a mirror of Ubuntu's main repository
123 87
 
124
-* ```vars```: Variables for Docker registry, the application, and aptly repository data location
125
-* ```build.sh```: Build the Docker image locally, this script will take the name of a Dockerfile as an argument, by default will build Dockerfile.
126
-* ```run.sh```: Starts the Docker container, it the image hasn't been built locally, it is fetched from the repository set in vars
127
-* ```push.sh```: Pushes the latest locally built image to the repository set in vars
128
-* ```shell.sh```: get a shell within the container
88
+1. Attach to the container. How attach? [See this](##Configure-the-container).
89
+2. Run `/opt/update_mirror.sh`.
129 90
 
130
-### How this image/container works
91
+By default, this script will automate the creation of an Ubuntu 14.04 Trusty repository with the main and universe components, you can adjust the variables in the script to suit your needs.
131 92
 
132
-**Data**  
133
-All of aptly's data (including PGP keys and GPG keyrings) is bind mounted outside of the container to preserve it if the container is removed or rebuilt. Set the location for the bind mount in ```vars``` before starting the container. If you're going to host a mirror of Ubuntu's main repository, you'll need upwards of 80GB+ (x86_64 only) of free space as of Feb 2016, plan for growth.
93
+> If the script fails due to network disconnects etc, just re-run it.
134 94
 
135
-**Networking**  
136
-By default, Docker will map port 80 on the Docker host to port 80 within the container where nginx is configured to listen. You can change the external listening port in ```vars``` to map to any port you like.
95
+ The initial download of the repository may take quite some time depending on your bandwidth limits, it may be in your best interest to open a screen, tmux or byobu session before proceeding.
137 96
 
138
-**Security**  
139
-The GPG password you set in ```vars``` is stored in plain text and is visible as an environment variable inside the container. It is set as an enviornment variable to allow for automation of repository updates without user interaction. The GPG password can be removed completely but it is safer to encrypt the GPG keyrings because they are bind mounted outside the container to avoid the necessity of regenerating/redistributing keys if the container is removed or rebuilt.
97
+> For host a mirror of Ubuntu's main repository, you'll need upwards of 80GB+ (x86_64 only) of free space as of Feb 2016, plan for growth.
140 98
 
141
-### Usage
99
+When the script completes, you should have a functional mirror that you can point a client to.
142 100
 
143
-#### Configure the container
101
+For create Debian's mirror use `/opt/debian_mirror.sh`.
144 102
 
145
-1. Configure application specific variables in ```vars```
103
+## Building the container
146 104
 
147
-#### Build the image
105
+If you want to customize image or build the container locally, check out this repository and build after:
148 106
 
149
-1. Run ```./build.sh```
107
+```bash
108
+git clone https://github.com/urpylka/docker-aptly.git
109
+docker build docker-aptly
110
+```
150 111
 
151
->To build a Debian-based mirror/aptly run ```./build.sh Dockerfile.debian```
112
+## How this image/container works
152 113
 
153
-#### Start the container
114
+**Data**  
115
+All of aptly's data (including PGP keys and GPG keyrings) is bind mounted outside of the container to preserve it if the container is removed or rebuilt.
154 116
 
155
-1. Run ```./run.sh```
156
-2. Wait until the GPG keyrings are created (not 0 bytes) before proceeding (it can take a few minutes). They will be in the bind mount location you chose in ```vars```
157
- 
158
-#### Pushing your image to the registry
117
+**Networking**  
118
+By default, Docker will map port 80 on the Docker host to port 80 within the container where nginx is configured to listen. You can change the external listening port to map to any port you like (see [Explane of the flags](###Explane-of-the-flags)).
159 119
 
160
-If you're happy with your container and ready to share with others, push your image up to a [Docker registry](https://docs.docker.com/docker-hub/) and save any other changes you've made so the image can be easily changed or rebuilt in the future.
120
+**Security**  
121
+The GPG password which you specified in `GPG_PASSWORD` is stored in plain text and visible as an environment variable inside the container.
122
+It is set as an enviornment variable to allow for automation of repository updates without user interaction. The GPG password can be removed completely but it is safer to encrypt the GPG keyrings because they are bind mounted outside the container to avoid the necessity of regenerating/redistributing keys if the container is removed or rebuilt.
161 123
 
162
-1. Authenticate to the Docker Registry ```docker login```
163
-2. Run ```./push.sh```
164
-3. Log into your Docker hub account and add a description, etc.
124
+## Bugs
165 125
 
166
-> NOTE: If your image will be used FROM other containers you might want to use ```./push.sh flatten``` to consolidate the AUFS layers into a single layer. Keep in mind, you may lose Dockerfile attributes when your image is flattened.
126
+* **startup.sh**: looks like that `gpg --batch --gen-key /opt/gpg_batch` execute in separating process & next step is incorrect.

Loading…
Cancel
Save