itamae-plugin-recipe-bedrock_server 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/test.yml +71 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +79 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/itamae-plugin-recipe-bedrock_server.gemspec +31 -0
- data/lib/itamae/plugin/recipe/bedrock_server.rb +14 -0
- data/lib/itamae/plugin/recipe/bedrock_server/default.rb +3 -0
- data/lib/itamae/plugin/recipe/bedrock_server/install.rb +12 -0
- data/lib/itamae/plugin/recipe/bedrock_server/service.rb +28 -0
- data/lib/itamae/plugin/recipe/bedrock_server/setup.rb +19 -0
- data/lib/itamae/plugin/recipe/bedrock_server/templates/etc/systemd/system/bedrock_server.service.erb +13 -0
- data/lib/itamae/plugin/recipe/bedrock_server/version.rb +11 -0
- data/recipes/install.rb +6 -0
- data/recipes/node.yml +6 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d11d81e37964b2e95787f8539e478fe8387a863cae7d6be116002486d090ac5
|
4
|
+
data.tar.gz: acb7821c226813e46620b970ac5b2154d641a8df263b0774fcf4025736361d3b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28e9a3caca5826fd65ff418b7cd1d714fd50efd3c95b60c39ed9ec40bd5513a49438331a7ef9a81d0d241110bbf26322d857242aec5b9f7a5b4481aa9f3bd6db
|
7
|
+
data.tar.gz: beb581ebd45cccbabffd9f61302e6a467c51c7d67c9a0a2a49aec055b01def371bee7835233feaed52d76053bfb8301e52a1477d4ffa405391b9becff5247fd4
|
@@ -0,0 +1,71 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
types:
|
9
|
+
- opened
|
10
|
+
- synchronize
|
11
|
+
- reopened
|
12
|
+
schedule:
|
13
|
+
- cron: "0 10 * * 5"
|
14
|
+
|
15
|
+
env:
|
16
|
+
CI: "true"
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
test:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
|
22
|
+
strategy:
|
23
|
+
fail-fast: false
|
24
|
+
|
25
|
+
matrix:
|
26
|
+
ruby:
|
27
|
+
- 2.6
|
28
|
+
- 3.0
|
29
|
+
image:
|
30
|
+
- ubuntu:18.04
|
31
|
+
- ubuntu:latest
|
32
|
+
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v2
|
35
|
+
|
36
|
+
- uses: eregon/use-ruby-action@v1
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.ruby }}
|
39
|
+
|
40
|
+
- name: Cache vendor/bundle
|
41
|
+
uses: actions/cache@v1
|
42
|
+
id: cache_gem
|
43
|
+
with:
|
44
|
+
path: vendor/bundle
|
45
|
+
key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
|
46
|
+
restore-keys: |
|
47
|
+
v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
|
48
|
+
- name: bundle update
|
49
|
+
run: |
|
50
|
+
set -xe
|
51
|
+
bundle config path vendor/bundle
|
52
|
+
bundle update --jobs $(nproc) --retry 3
|
53
|
+
- name: Start container
|
54
|
+
run: |
|
55
|
+
set -xe
|
56
|
+
docker run --name tmp-ubuntu $IMAGE bash -c "apt-get update && apt-get install -y systemd-sysv"
|
57
|
+
docker commit tmp-ubuntu ubuntu-with-systemd
|
58
|
+
docker run --privileged -d --name container-with-service ubuntu-with-systemd /sbin/init
|
59
|
+
env:
|
60
|
+
IMAGE: ${{ matrix.image }}
|
61
|
+
|
62
|
+
- name: Run Itamae
|
63
|
+
run: |
|
64
|
+
set -xe
|
65
|
+
bundle exec itamae docker --node-yaml=recipes/node.yml recipes/install.rb --container=container-with-service --tag itamae-plugin:latest
|
66
|
+
- name: Run Serverspec
|
67
|
+
run: |
|
68
|
+
set -xe
|
69
|
+
bundle exec rspec
|
70
|
+
env:
|
71
|
+
DOCKER_CONTAINER: container-with-service
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 kyohah
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# Itamae::Plugin::Recipe::BedrockServer
|
2
|
+
|
3
|
+
Itamae plugin to install [Minecraft](https://www.minecraft.net/) with init scripts
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/itamae-plugin-recipe-bedrock_server.svg)](https://badge.fury.io/rb/itamae-plugin-recipe-bedrock_server)
|
6
|
+
![test](https://github.com/kyohah/itamae-plugin-recipe-bedrock_server/workflows/test/badge.svg)
|
7
|
+
|
8
|
+
## Supported
|
9
|
+
* Ubuntu 18 or later [^1]
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'itamae-plugin-recipe-bedrock_server'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install itamae-plugin-recipe-bedrock_server
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
### Recipe
|
30
|
+
|
31
|
+
Install bedrock_server executable file and init scritps (systemd or init.d)
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
# recipe.rb
|
35
|
+
include_recipe "bedrock_server"
|
36
|
+
```
|
37
|
+
|
38
|
+
Or `include_recipe` just what you need manually:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
include_recipe "bedrock_server::setup"
|
42
|
+
include_recipe "bedrock_server::install"
|
43
|
+
include_recipe "bedrock_server::service"
|
44
|
+
```
|
45
|
+
|
46
|
+
### Node
|
47
|
+
|
48
|
+
```yml
|
49
|
+
# node.yml
|
50
|
+
bedrock_server:
|
51
|
+
# path to downloaded zip file (default: "/opt")
|
52
|
+
app_dir: "/opt"
|
53
|
+
|
54
|
+
# start environment (default: ".")
|
55
|
+
ld_library_path: "."
|
56
|
+
|
57
|
+
# bedrock_server service actions when after install (default: enable, start)
|
58
|
+
service_actions:
|
59
|
+
- enable
|
60
|
+
- start
|
61
|
+
# - disable
|
62
|
+
# - stop
|
63
|
+
```
|
64
|
+
|
65
|
+
## Development
|
66
|
+
|
67
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
68
|
+
|
69
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kyohah/itamae-plugin-recipe-bedrock_server.
|
74
|
+
|
75
|
+
## License
|
76
|
+
|
77
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
78
|
+
|
79
|
+
[^1]: bedrock-server-1.16.201.02/bedrock_server_how_to.html
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "itamae/plugin/recipe/bedrock_server"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/itamae/plugin/recipe/bedrock_server/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "itamae-plugin-recipe-bedrock_server"
|
7
|
+
spec.version = Itamae::Plugin::Recipe::BedrockServer::VERSION
|
8
|
+
spec.authors = ["kyohah"]
|
9
|
+
spec.email = ["3257272+kyohah@users.noreply.github.com"]
|
10
|
+
|
11
|
+
spec.summary = "Itamae plugin to install Minecraft with init scripts."
|
12
|
+
spec.description = "Itamae plugin to install Minecraft with init scripts."
|
13
|
+
spec.homepage = "https://github.com/kyohah/itamae-plugin-recipe-bedrock_server"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_dependency "itamae"
|
28
|
+
|
29
|
+
spec.add_development_dependency "docker-api"
|
30
|
+
spec.add_development_dependency "serverspec"
|
31
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
package "unzip"
|
4
|
+
package "curl"
|
5
|
+
|
6
|
+
bedrock_server_url = node[:bedrock_server][:url] || URI.open("https://minecraft.net/en-us/download/server/bedrock/").read.match(/https:\/\/minecraft\.azureedge\.net\/bin-linux\/bedrock-server-[.0-9]*\.zip/).to_s
|
7
|
+
|
8
|
+
http_request "bedrock-server.zip" do
|
9
|
+
url bedrock_server_url
|
10
|
+
end
|
11
|
+
|
12
|
+
execute "unzip -o bedrock-server.zip -d #{node[:bedrock_server][:app_dir]}/bedrock-server"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
environment_content =
|
2
|
+
<<-EOS
|
3
|
+
LD_LIBRARY_PATH=#{node[:bedrock_server][:ld_library_path]}
|
4
|
+
EOS
|
5
|
+
|
6
|
+
environment_file = "/etc/default/bedrock_server"
|
7
|
+
|
8
|
+
file environment_file do
|
9
|
+
mode "644"
|
10
|
+
content environment_content
|
11
|
+
notifies :restart, "service[bedrock_server]"
|
12
|
+
end
|
13
|
+
|
14
|
+
template "/etc/systemd/system/bedrock_server.service" do
|
15
|
+
mode "644"
|
16
|
+
variables(
|
17
|
+
environment_file: environment_file,
|
18
|
+
app_dir: "#{node[:bedrock_server][:app_dir]}",
|
19
|
+
)
|
20
|
+
|
21
|
+
notifies :restart, "service[bedrock_server]"
|
22
|
+
end
|
23
|
+
|
24
|
+
directory "/etc/bedrock_server.d"
|
25
|
+
|
26
|
+
service "bedrock_server" do
|
27
|
+
action node[:bedrock_server][:service_actions]
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Check required node values
|
2
|
+
# node.validate! do
|
3
|
+
# {
|
4
|
+
# bedrock_server: {
|
5
|
+
# version: string,
|
6
|
+
# },
|
7
|
+
# }
|
8
|
+
# end
|
9
|
+
|
10
|
+
# Set default node values
|
11
|
+
node.reverse_merge!(
|
12
|
+
bedrock_server: {
|
13
|
+
app_dir: "/opt",
|
14
|
+
ld_library_path: ".",
|
15
|
+
service_actions: [:enable, :start]
|
16
|
+
},
|
17
|
+
)
|
18
|
+
|
19
|
+
node[:bedrock_server][:service_actions] ||= []
|
data/lib/itamae/plugin/recipe/bedrock_server/templates/etc/systemd/system/bedrock_server.service.erb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Minecraft Bedrock Server
|
3
|
+
After=network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
EnvironmentFile=-<%= @environment_file %>
|
7
|
+
Type=simple
|
8
|
+
WorkingDirectory=<%= @app_dir %>/bedrock-server
|
9
|
+
ExecStart=<%= @app_dir %>/bedrock-server/bedrock_server
|
10
|
+
Restart=on-failure
|
11
|
+
|
12
|
+
[Install]
|
13
|
+
WantedBy=multi-user.target
|
data/recipes/install.rb
ADDED
data/recipes/node.yml
ADDED
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itamae-plugin-recipe-bedrock_server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kyohah
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: itamae
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: docker-api
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: serverspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Itamae plugin to install Minecraft with init scripts.
|
56
|
+
email:
|
57
|
+
- 3257272+kyohah@users.noreply.github.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".github/workflows/test.yml"
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- itamae-plugin-recipe-bedrock_server.gemspec
|
72
|
+
- lib/itamae/plugin/recipe/bedrock_server.rb
|
73
|
+
- lib/itamae/plugin/recipe/bedrock_server/default.rb
|
74
|
+
- lib/itamae/plugin/recipe/bedrock_server/install.rb
|
75
|
+
- lib/itamae/plugin/recipe/bedrock_server/service.rb
|
76
|
+
- lib/itamae/plugin/recipe/bedrock_server/setup.rb
|
77
|
+
- lib/itamae/plugin/recipe/bedrock_server/templates/etc/systemd/system/bedrock_server.service.erb
|
78
|
+
- lib/itamae/plugin/recipe/bedrock_server/version.rb
|
79
|
+
- recipes/install.rb
|
80
|
+
- recipes/node.yml
|
81
|
+
homepage: https://github.com/kyohah/itamae-plugin-recipe-bedrock_server
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
metadata:
|
85
|
+
homepage_uri: https://github.com/kyohah/itamae-plugin-recipe-bedrock_server
|
86
|
+
source_code_uri: https://github.com/kyohah/itamae-plugin-recipe-bedrock_server
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.3.0
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.2.3
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Itamae plugin to install Minecraft with init scripts.
|
106
|
+
test_files: []
|