seira 0.8.3 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/package-seira-gem.yml +36 -0
- data/.trunk/trunk.yaml +2 -2
- data/README.md +17 -15
- data/bin/release +22 -0
- data/lib/seira/pods.rb +2 -2
- data/lib/seira/settings.rb +11 -0
- data/lib/seira/version.rb +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcb71602621b522d12285dbeb5e752dcedbc246b4d490726fdaa61a5d3441579
|
4
|
+
data.tar.gz: ded0a32bb25d7df60741c76b93b8b8622dd10389edb324e83d2299e2aed43e56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd862ede0cc26ca23eb684f8b962e461b96c975b9ec09dbc314e15e7e2db6e51622da989f12ac7ff4baab3f73ad5dc0de3b201cf2cbb23fbfd13ee6ab6e2f12d
|
7
|
+
data.tar.gz: 1b9b00330a3a1e0fde8472c0c9cccbbeac266f85c39badf210a06686136845d94db0f2e3b12a767a6c9fc6152150d59ccc9f491ad3bff5fb9db6cc3afeebff73
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: Package Seira Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- "*"
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
permissions:
|
13
|
+
contents: read
|
14
|
+
packages: write
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v3
|
18
|
+
- name: Set up Ruby 2.7.7
|
19
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
20
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
21
|
+
# uses: ruby/setup-ruby@v1
|
22
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
23
|
+
with:
|
24
|
+
ruby-version: 2.7.7
|
25
|
+
|
26
|
+
- name: Publish to GPR
|
27
|
+
run: |
|
28
|
+
mkdir -p $HOME/.gem
|
29
|
+
touch $HOME/.gem/credentials
|
30
|
+
chmod 0600 $HOME/.gem/credentials
|
31
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
32
|
+
gem build seira.gemspec
|
33
|
+
export RELEASE_VER=$(bundle exec ruby -e 'require "seira"; puts Seira::VERSION')
|
34
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/joinhandshake seira-"${RELEASE_VER}".gem
|
35
|
+
env:
|
36
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.PACKAGES_TOKEN}}" # Apparently GITHUB_TOKEN is supposed to work here, but it doesn't. Even with the permissions set under jobs.build.permissions.
|
data/.trunk/trunk.yaml
CHANGED
@@ -15,7 +15,6 @@ runtimes:
|
|
15
15
|
lint:
|
16
16
|
enabled:
|
17
17
|
- actionlint@1.6.25
|
18
|
-
- checkov@2.4.6
|
19
18
|
- git-diff-check
|
20
19
|
- markdownlint@0.35.0
|
21
20
|
- prettier@3.0.2
|
@@ -23,8 +22,9 @@ lint:
|
|
23
22
|
- shfmt@3.6.0
|
24
23
|
- trivy@0.44.1
|
25
24
|
- trufflehog@3.48.0
|
26
|
-
- yamllint@1.32.0
|
27
25
|
disabled:
|
26
|
+
- checkov@2.4.6
|
27
|
+
- yamllint@1.32.0
|
28
28
|
- rubocop@1.39.0
|
29
29
|
actions:
|
30
30
|
enabled:
|
data/README.md
CHANGED
@@ -116,28 +116,28 @@ All functionality is targeted to be a platform on top of Kubernetes that has a H
|
|
116
116
|
|
117
117
|
### App
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
- Bootstrap new applications
|
120
|
+
- Apply new configurations to an application
|
121
|
+
- Scale app tiers
|
122
|
+
- Restart an application
|
123
123
|
|
124
124
|
### Database (Postgres)
|
125
125
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
126
|
+
- List postgres instances
|
127
|
+
- Create new primary and automatically set the right secrets with configurability such as HA, CPU, Memory.
|
128
|
+
- Create a new replica on the primary
|
129
|
+
- Pgbouncer yaml generation for all new instances
|
130
|
+
- Delete an instance
|
131
131
|
|
132
132
|
### Pods
|
133
133
|
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
- List pods for a given app
|
135
|
+
- Connect to a running pod to run commands
|
136
|
+
- Run a one-off command such as `rails db:migrate`
|
137
137
|
|
138
138
|
### Secrets
|
139
139
|
|
140
|
-
|
140
|
+
- List, set, unset secrets
|
141
141
|
|
142
142
|
## Example Usage
|
143
143
|
|
@@ -173,6 +173,10 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
173
173
|
|
174
174
|
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).
|
175
175
|
|
176
|
+
## Packages
|
177
|
+
|
178
|
+
A Github acions workflow will build and push a new release to Github packages on on new tags. You can cut a new release using `./bin/release` to push a new tag and trigger a release.
|
179
|
+
|
176
180
|
## Contributing
|
177
181
|
|
178
182
|
Bug reports and pull requests are welcome on GitHub at https://github.com/joinhandshake/seira.
|
@@ -185,8 +189,6 @@ Future roadmap has plans for:
|
|
185
189
|
- More functionality for managing pods
|
186
190
|
- More seamless `seira setup` script
|
187
191
|
|
188
|
-
|
189
192
|
## License
|
190
193
|
|
191
194
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
192
|
-
|
data/bin/release
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#! /usr/bin/env bash
|
2
|
+
|
3
|
+
version=$(bundle exec ruby -e 'require "seira"; puts Seira::VERSION')
|
4
|
+
branch=$(git rev-parse --abbrev-ref HEAD)
|
5
|
+
|
6
|
+
version_tag="v${version}"
|
7
|
+
|
8
|
+
git fetch origin --tags
|
9
|
+
|
10
|
+
if [[ ${branch} != "main" ]]; then
|
11
|
+
echo "You must be on the main branch to release"
|
12
|
+
exit 1
|
13
|
+
fi
|
14
|
+
|
15
|
+
# shellcheck disable=SC2312
|
16
|
+
if git tag | grep -q "${version_tag}"; then
|
17
|
+
echo "Tag ${version_tag} already exists"
|
18
|
+
exit 1
|
19
|
+
fi
|
20
|
+
|
21
|
+
echo git tag "${verison_tag}"
|
22
|
+
echo git push origin "${version_tag}"
|
data/lib/seira/pods.rb
CHANGED
@@ -70,7 +70,6 @@ module Seira
|
|
70
70
|
pod_name = pod_name
|
71
71
|
dedicated = false
|
72
72
|
command = 'sh'
|
73
|
-
|
74
73
|
args.each do |arg|
|
75
74
|
if arg.start_with? '--tier='
|
76
75
|
tier = arg.split('=')[1]
|
@@ -152,6 +151,7 @@ module Seira
|
|
152
151
|
# for a simple terminal pod it's fine
|
153
152
|
spec['containers'].each do |container|
|
154
153
|
container['command'] = %w[sleep 86400] # 86400 seconds = 24 hours
|
154
|
+
container.delete('args')
|
155
155
|
end
|
156
156
|
|
157
157
|
puts 'Creating dedicated pod...'
|
@@ -181,7 +181,7 @@ module Seira
|
|
181
181
|
|
182
182
|
def connect_to_pod(name, command = 'sh')
|
183
183
|
puts "Connecting to #{name}..."
|
184
|
-
system("kubectl exec -ti #{name} --namespace=#{app} -- #{command}")
|
184
|
+
system("kubectl exec -ti #{name} --namespace=#{app} -- #{context[:settings].terminal_prefix(app, context[:cluster])} #{command}")
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
data/lib/seira/settings.rb
CHANGED
@@ -94,6 +94,17 @@ module Seira
|
|
94
94
|
requirements.map { |r| Seira::Teleport::RoleRequirement.new(r) }
|
95
95
|
end
|
96
96
|
|
97
|
+
def terminal_prefix(application, cluster)
|
98
|
+
settings['seira']['applications'].each do |app|
|
99
|
+
if app['name'] == application
|
100
|
+
return app.fetch('terminal_prefix', '') if app['terminal_prefix_envs'].nil?
|
101
|
+
return app.fetch('terminal_prefix', '') if app['terminal_prefix_envs'].include? cluster
|
102
|
+
|
103
|
+
return ''
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
97
108
|
private
|
98
109
|
|
99
110
|
def parse_settings
|
data/lib/seira/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Ringwelski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -102,6 +102,7 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".github/workflows/package-seira-gem.yml"
|
105
106
|
- ".github/workflows/ruby.yml"
|
106
107
|
- ".github/workflows/trunk.yml"
|
107
108
|
- ".gitignore"
|
@@ -118,6 +119,7 @@ files:
|
|
118
119
|
- README.md
|
119
120
|
- Rakefile
|
120
121
|
- bin/console
|
122
|
+
- bin/release
|
121
123
|
- bin/seira
|
122
124
|
- bin/setup
|
123
125
|
- lib/helpers.rb
|