Skip to content

Commit

Permalink
release: add Rack application skeleton for automatic deployment (#45)
Browse files Browse the repository at this point in the history
GitHub: GH-43

In this PR, we set up a Rack application skeleton for automatic
deployment using webhook.
At the following PRs, we will implement the logic of automatic sign as
first steps.

### Call webhook

```console
$ cd ansible/files/home/deployer/webhook
$ gem install rackup
$ bundle install
$ rackup &
$ curl localhost:9292
127.0.0.1 - - [10/Dec/2024:16:33:28 +0900] "GET / HTTP/1.1" 200 - 0.0001
Hello deployer
```
  • Loading branch information
otegami authored Dec 11, 2024
1 parent c704067 commit fd8bf4c
Show file tree
Hide file tree
Showing 6 changed files with 764 additions and 0 deletions.
674 changes: 674 additions & 0 deletions ansible/files/home/deployer/COPYING

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions ansible/files/home/deployer/webhook/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2024 Takuya Kodama <[email protected]>
#
# 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 <https://www.gnu.org/licenses/>.

/Gemfile.lock
18 changes: 18 additions & 0 deletions ansible/files/home/deployer/webhook/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2024 Takuya Kodama <[email protected]>
#
# 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 <https://www.gnu.org/licenses/>.

source "https://rubygems.org"

gem "rack"
18 changes: 18 additions & 0 deletions ansible/files/home/deployer/webhook/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2024 Takuya Kodama <[email protected]>
#
# 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 <https://www.gnu.org/licenses/>.

require_relative "lib/deployer"

run Deployer::App.new
16 changes: 16 additions & 0 deletions ansible/files/home/deployer/webhook/lib/deployer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2024 Takuya Kodama <[email protected]>
#
# 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 <https://www.gnu.org/licenses/>.

require_relative "deployer/app"
22 changes: 22 additions & 0 deletions ansible/files/home/deployer/webhook/lib/deployer/app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2024 Takuya Kodama <[email protected]>
#
# 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 <https://www.gnu.org/licenses/>.

module Deployer
class App
def call(env)
[200, {}, ["Hello deployer"]]
end
end
end

0 comments on commit fd8bf4c

Please sign in to comment.