This cookbook installs and configures aptly (http://www.aptly.info)
- Debian 8
- Debian 9
- Ubuntu 16.04
- Ubuntu 18.04
default['aptly']['repository']['uri'] = 'http://repo.aptly.info/'
default['aptly']['repository']['dist'] = 'squeeze'
default['aptly']['repository']['components'] = 'main'
default['aptly']['repository']['key'] = 'https://www.aptly.info/pubkey.txt'
default['aptly']['user'] = 'aptly'
default['aptly']['group'] = 'aptly'
default['aptly']['rootDir'] = '/opt/aptly'
default['aptly']['downloadConcurrency'] = 4
default['aptly']['downloadSpeedLimit'] = 0
default['aptly']['architectures'] = []
default['aptly']['dependencyFollowSuggests'] = false
default['aptly']['dependencyFollowRecommends'] = false
default['aptly']['dependencyFollowAllVariants'] = false
default['aptly']['dependencyFollowSource'] = false
default['aptly']['gpgDisableSign'] = false
default['aptly']['gpgDisableVerify'] = false
default['aptly']['gpgProvider'] = 'gpg'
default['aptly']['downloadSourcePackages'] = false
default['aptly']['skipLegacyPool'] = true
default['aptly']['ppaDistributorID'] = 'ubuntu'
default['aptly']['ppaCodename'] = ''
default['aptly']['FileSystemPublishEndpoints'] = {}
default['aptly']['S3PublishEndpoints'] = {}
default['aptly']['SwiftPublishEndpoints'] = {}
default['aptly']['gpg']['name-real'] = 'Aptly'
default['aptly']['gpg']['name-comment'] = 'Aptly Key'
default['aptly']['gpg']['name-email'] = '[email protected]'
default['aptly']['gpg']['expire-date'] = 0
default['aptly']['gpg']['passphrase'] = 'GreatPassPhrase'
Install and configure aptly
Manage local repositories
create
- (default) Create a repodrop
- Drop an existed repositoryadd
- Add packages to a repositoryremove
- remove a package from a repository
Name | Types | Description | Default | Used with... |
---|---|---|---|---|
repo_name |
String | Name of the repository | <resource_name> | all |
component |
String | Repository component | '' | :create |
comment |
String | Repository's comment | '' | :create |
distribution |
String | Name of distribution repository | '' | :create |
remove_files |
[true, false] | Remove files that have been imported successfully into repository | false | :add |
force_replace |
[true, false] | Remove/override existing package when exists | false | :add |
directory |
String | Look in this directory to add multiple packages | '' | :add |
file |
String | Specify a package file to add to the repository | '' | :add |
package_query |
String | Package name to remove from repository | '' | :remove |
aptly_repo 'my_repo' do
comment 'A repository of packages'
component 'main'
distribution 'bionic'
action :create
end
aptly_repo 'repo_with_no_comment' do
action :create
end
aptly_repo 'my_repo' do
action :drop
end
aptly_repo 'my_repo' do
file '/path/to/package-1.0.1.deb'
action :add
end
aptly_repo 'my_repo' do
directory '/path/to/packages'
action :add
end
aptly_repo 'my_repo' do
package_query 'package-1.0.1.deb'
action :remove
end
Manage external mirror
create
- (default) Create a mirror from external repositorydrop
- Drop created mirrorupdate
- Update/Sync your mirror
Name | Types | Description | Default | Used with... |
---|---|---|---|---|
mirror_name |
String | Mirror name | <resource_name> | all |
component |
String | Repository component | '' | :create |
distribution |
String | Name of distribution repository | '' | :create |
uri |
String | Uri of remote repository | '' | :create |
keyid |
String | Remote repository key ID | '' | :create |
keyserver |
String | Keys server | 'keys.gnupg.net' | :create |
cookbook |
String | Cookbook name where you've store the keyfile | '' | :create |
keyfile |
String | Key file name | '' | :create |
filter |
String | Mirror filter | '' | :creates |
aptly_mirror 'nginx-bionic' do
distribution 'bionic'
component 'nginx'
keyid '7BD9BF62'
keyserver 'keyserver.ubuntu.com'
uri 'http://nginx.org/packages/ubuntu/'
end
aptly_mirror 'nginx-bionic' do
action :update
end
aptly_mirror 'nginx-bionic' do
action :drop
end
Manage aptly snapshots
create
- (default) Create a snapshot from an internal repository or mirrordrop
- Drop created snapshotverify
- Verifies dependencies between packages in snapshotpull
- Pulls new packages to snapshot from source snapshotmerge
- Merges several source snapshots into new destination snapshot
Name | Types | Description | Default | Used with... |
---|---|---|---|---|
snapshot_name |
String | Snapshot name | <resource_name> | all |
from |
String | Name of mirror or repo to snapshot | '' | :create |
type |
String | Type of snapshot source (repo, mirror or snapshot) | '' | :create |
empty |
[true, false] | Create an empty snapshot | false | :create |
source |
String | Snapshot name where packages would be searched | '' | :pull |
destination |
String | Name of the snapshot that would be created | '' | :pull |
package_query |
String | Query/package name to be pulled from | '' | :pull |
no_deps |
[true, false] | Don’t process dependencies | false | :pull |
no_remove |
[true, false] | Don’t remove other package versions when pulling package | false | :pull, :merge |
merge_sources |
Array | Array of snapshot names to merge | '' | :merge |
latest |
[true, false] | Use only the latest version of each package | false | :merge |
aptly_snapshot 'my_snapshot' do
from 'my_repo'
type 'repo'
end
aptly_snapshot 'my_snapshot' do
action :drop
end
aptly_snapshot 'merged_snapshot' do
merge_sources %w(snapshot1 snapshot2)
action :merge
end
aptly_snapshot 'merged_snapshot' do
action :verify
end
aptly_snapshot 'merged_snapshot' do
package_query 'curl_7.52.1-5+deb9u7_amd64.deb'
source 'my_snapshot'
destination 'new_my_snapshot'
action :pull
end
Publish, remove or update a repo or a snapshot
create
- (default) Publish a repo or a snapshotdrop
- Drop a publicationupdate
- Update publication
Name | Types | Description | Default | Used with... |
---|---|---|---|---|
publish_name |
String | Publication name | <resource_name> | all |
type |
String | Publish type (snapshot or repo) | '' | :create |
component |
String | Component name to publish | [] | :create |
distribution |
String | Distribution name to publish | '' | :create |
architectures |
String | Only mentioned architectures would be published | ['amd64'] | :create |
endpoint |
String | An optional endpoint reference | '' | :create, :update |
prefix |
String | An optional prefix for publishing | '' | :create, :update |
aptly_publish 'my_repo' do
type 'repo'
component %w(main contrib)
prefix 'my_company'
end
aptly_publish 'my_snapshot' do
type 'snapshot'
endpoint 's3'
prefix 'snap'
action :create
end
aptly_publish 'my_snapshot' do
prefix 'snap'
action :update
end
aptly_publish 'my_snapshot' do
prefix 'snap'
action :drop
end
Serve an HTTP Service
run
- (default) Run the service
Name | Types | Description | Default | Used with... |
---|---|---|---|---|
listen |
String | Specify IP address about HTTP listening | '' (all interfaces) | :run |
port |
[Integer, String] | Publish type (snapshot or repo) | 8080 | :run |
user |
String | Run command as user | 'aptly' | :run |
group |
String | Run command as group | 'aptly' | :run |
aptly_serve 'Serve Aptly HTTP Service' do
port 8090
end
Serve an API Service
run
- (default) Run the service
Name | Types | Description | Default | Used with... |
---|---|---|---|---|
listen |
String | Specify IP address about HTTP listening | '' (all interfaces) | :run |
port |
[Integer, String] | Publish type (snapshot or repo) | 8080 | :run |
user |
String | Run command as user | 'aptly' | :run |
group |
String | Run command as group | 'aptly' | :run |
no_lock |
[true, false] | Don’t lock the database | false | :run |
aptly_api_serve 'Serve Aptly API Service' do
port 8091
no_lock true
end
Manage internal Aptly DB
cleanup
- (default) Database cleanup removes information about unreferenced packages and deletes files in the package pool that aren’t used by packages anymore.recover
- Database recover does its best to recover database after crash.
None
aptly_db 'cleanup' do
action :cleanup
end
aptly_db 'recover' do
action :recover
end
include_recipe 'aptly'
aptly_repo 'my_repo' do
comment 'A repository of packages'
component 'main'
distribution 'bionic'
end
aptly_snapshot 'my_snapshot' do
from 'my_repo'
type 'repo'
end
aptly_publish 'my_repo' do
type 'repo'
prefix 'ubuntu'
end
aptly_serve 'Aptly HTTP Service'
Please refer to each project's style guidelines and guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
Please contribute to keep unit and functional tests up to date. After modifications, please run the following commands to check if you break something:
- chef exec rspec
- kitchen test default-ubuntu-1804
NOTE: Available distro tests: default-debian-8
, default-debian-9
, default-ubuntu-1604
and default-ubuntu-1804
NOTE2: if you want to use Policyfile, rename Policyfile.rb.dist
to Policyfile.rb
in root and test directories, then execute chef update
in each folder. Look inside .kitchen.yml
and spec/spec_helper.rb
too.
- Author:: Aaron Baer ([email protected])
- Contributor:: Michael Lopez ([email protected])
Copyright 2014, Heavy Water Operations, LLC
Copyright 2018, Michael Lopez
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.