Skip to content

Commit e385abe

Browse files
committed
Adjust copyright year, switch to sleeplocks
1 parent a5c26a1 commit e385abe

24 files changed

+68
-54
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<p align="center">
2-
<img alt="Lynx Logo" src="/assets/img/logo.png?v=0.12.7" width="400" />
2+
<img alt="Lynx Logo" src="/assets/img/logo.png?v=0.12.8" width="400" />
33
<h3 align="center">Lynx</h3>
44
<p align="center">A Fast, Secure and Reliable Terraform Backend, Set up in Minutes.</p>
55
<p align="center">
66
<a href="https://github.com/Clivern/Lynx/actions/workflows/ci.yml">
77
<img src="https://github.com/Clivern/Lynx/actions/workflows/server_ci.yml/badge.svg"/>
88
</a>
99
<a href="https://github.com/Clivern/Lynx/releases">
10-
<img src="https://img.shields.io/badge/Version-0.12.7-1abc9c.svg">
10+
<img src="https://img.shields.io/badge/Version-0.12.8-1abc9c.svg">
1111
</a>
1212
<a href="https://hub.docker.com/r/clivern/lynx/tags">
13-
<img src="https://img.shields.io/badge/Docker-0.12.7-1abc9c.svg">
13+
<img src="https://img.shields.io/badge/Docker-0.12.8-1abc9c.svg">
1414
</a>
1515
<a href="https://github.com/Clivern/terraform-provider-lynx">
1616
<img src="https://img.shields.io/badge/Terraform-Provider-yellow.svg">

api.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ info:
77
license:
88
name: MIT License
99
url: https://github.com/Clivern/Lynx/blob/main/LICENSE
10-
version: 0.12.7
10+
version: 0.12.8
1111
externalDocs:
1212
description: Find out more about lynx
1313
url: https://github.com/Clivern/Lynx

docker-compose-cluster.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.8'
22

33
services:
44
app1:
5-
image: clivern/lynx:0.12.7
5+
image: clivern/lynx:0.12.8
66
environment:
77
APP_NAME: Lynx
88
APP_PORT: 4001
@@ -27,7 +27,7 @@ services:
2727
- db
2828

2929
app2:
30-
image: clivern/lynx:0.12.7
30+
image: clivern/lynx:0.12.8
3131
environment:
3232
APP_NAME: Lynx
3333
APP_PORT: 4002
@@ -52,7 +52,7 @@ services:
5252
- db
5353

5454
app3:
55-
image: clivern/lynx:0.12.7
55+
image: clivern/lynx:0.12.8
5656
environment:
5757
APP_NAME: Lynx
5858
APP_PORT: 4003

docker-compose-nginx.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.8'
22

33
services:
44
app:
5-
image: clivern/lynx:0.12.7
5+
image: clivern/lynx:0.12.8
66
environment:
77
APP_NAME: Lynx
88
APP_PORT: 4000

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.8'
22

33
services:
44
app:
5-
image: clivern/lynx:0.12.7
5+
image: clivern/lynx:0.12.8
66
environment:
77
APP_NAME: Lynx
88
APP_PORT: 4000

docs/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ hero:
2121
icon: edit
2222

2323
download_link:
24-
label: Latest Release v0.12.7
25-
url: https://github.com/Clivern/Lynx/releases/tag/0.12.7
24+
label: Latest Release v0.12.8
25+
url: https://github.com/Clivern/Lynx/releases/tag/0.12.8
2626

2727
features:
2828
rows:

example/backend.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
terraform {
22
backend "http" {
3-
address = "http://localhost:4000/client/clivern/monitoring/prod/state"
4-
lock_address = "http://localhost:4000/client/clivern/monitoring/prod/lock"
5-
unlock_address = "http://localhost:4000/client/clivern/monitoring/prod/unlock"
3+
address = "http://localhost:4000/client/clivern/grafana_infra/prod/state"
4+
lock_address = "http://localhost:4000/client/clivern/grafana_infra/prod/lock"
5+
unlock_address = "http://localhost:4000/client/clivern/grafana_infra/prod/unlock"
66
lock_method = "POST"
77
unlock_method = "POST"
88
}

lib/lynx/context/lock_context.ex

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ defmodule Lynx.Context.LockContext do
7676
where: l.environment_id == ^environment_id,
7777
where: l.is_active == true
7878
)
79-
|> lock("FOR UPDATE")
8079
|> limit(1)
8180
|> Repo.one()
8281
end

lib/lynx/module/lock_module.ex

+21-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ defmodule Lynx.Module.LockModule do
1616
Lock an environment
1717
"""
1818
def lock_action(params \\ %{}) do
19+
:sleeplocks.new(1, name: :lynx_lock)
20+
1921
case TeamContext.get_team_by_slug(params[:t_slug]) do
2022
nil ->
2123
{:not_found, "Team not found"}
@@ -43,16 +45,27 @@ defmodule Lynx.Module.LockModule do
4345
is_active: true
4446
})
4547

46-
case LockContext.create_lock(lock) do
47-
{:ok, _} ->
48-
{:success, ""}
48+
case :sleeplocks.attempt(:lynx_lock) do
49+
:ok ->
50+
case LockContext.create_lock(lock) do
51+
{:ok, _} ->
52+
:sleeplocks.release(:lynx_lock)
53+
{:success, ""}
54+
55+
{:error, changeset} ->
56+
:sleeplocks.release(:lynx_lock)
57+
58+
messages =
59+
changeset.errors()
60+
|> Enum.map(fn {field, {message, _options}} ->
61+
"#{field}: #{message}"
62+
end)
4963

50-
{:error, changeset} ->
51-
messages =
52-
changeset.errors()
53-
|> Enum.map(fn {field, {message, _options}} -> "#{field}: #{message}" end)
64+
{:error, Enum.at(messages, 0)}
65+
end
5466

55-
{:error, Enum.at(messages, 0)}
67+
{:error, :unavailable} ->
68+
{:error, "Unable to hold a lock on environment"}
5669
end
5770
end
5871
end

lib/lynx_web/router.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ defmodule LynxWeb.Router do
133133

134134
defp add_server_header(conn, _opts) do
135135
conn
136-
|> put_resp_header("x-server-version", "lynx/0.12.7")
136+
|> put_resp_header("x-server-version", "lynx/0.12.8")
137137
end
138138

139139
# Enables LiveDashboard only for development

lib/lynx_web/templates/error/404.html.heex

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<p><a href={Routes.page_path(@conn, :home)}><%= gettext "Back to Home" %></a></p>
2727
<br />
2828
<small>
29-
<%= gettext "Copyright © 2024" %> <a href="https://github.com/clivern" target="_blank" rel="noopener">Clivern</a><br/>
29+
<%= gettext "Copyright © 2025" %> <a href="https://github.com/clivern" target="_blank" rel="noopener">Clivern</a><br/>
3030
</small>
3131
</div>
3232
</div>

lib/lynx_web/templates/page/404.html.heex

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<p><a href={Routes.page_path(@conn, :home)}><%= gettext "Back to Home" %></a></p>
2727
<br />
2828
<small>
29-
<%= gettext "Copyright © 2024" %> <a href="https://github.com/clivern" target="_blank" rel="noopener">Clivern</a><br/>
29+
<%= gettext "Copyright © 2025" %> <a href="https://github.com/clivern" target="_blank" rel="noopener">Clivern</a><br/>
3030
</small>
3131
</div>
3232
</div>

lib/lynx_web/templates/page/home.html.heex

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<p><a href={Routes.page_path(@conn, :login)}><%= gettext "Login into your Account" %></a></p>
3232
<br />
3333
<small>
34-
<%= gettext "Copyright © 2024" %> <a href="https://github.com/clivern" target="_blank" rel="noopener">Clivern</a><br/>
34+
<%= gettext "Copyright © 2025" %> <a href="https://github.com/clivern" target="_blank" rel="noopener">Clivern</a><br/>
3535
</small>
3636
</div>
3737
</div>

lib/lynx_web/templates/page/profile.html.heex

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<div class="col hp-flex-none w-auto hp-horizontal-block">
2121
<div class="hp-header-logo d-flex align-items-end">
22-
<a href={Routes.page_path(@conn, :projects)}>
22+
<a href={Routes.page_path(@conn, :profile)}>
2323
<img class="hp-logo hp-sidebar-visible" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
2424
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-none" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
2525
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-block" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
@@ -321,7 +321,7 @@
321321
<footer class="w-100 py-18 px-16 py-sm-24 px-sm-32 hp-bg-color-black-20 hp-bg-color-dark-90">
322322
<div class="row">
323323
<div class="col-12">
324-
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2024 Clivern. All rights Reserved" %></p>
324+
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2025 Clivern. All rights Reserved" %></p>
325325
</div>
326326
</div>
327327
</footer>

lib/lynx_web/templates/page/project.html.heex

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
<footer class="w-100 py-18 px-16 py-sm-24 px-sm-32 hp-bg-color-black-20 hp-bg-color-dark-90">
464464
<div class="row">
465465
<div class="col-12">
466-
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2024 Clivern. All rights Reserved" %></p>
466+
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2025 Clivern. All rights Reserved" %></p>
467467
</div>
468468
</div>
469469
</footer>

lib/lynx_web/templates/page/projects.html.heex

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@
476476
<footer class="w-100 py-18 px-16 py-sm-24 px-sm-32 hp-bg-color-black-20 hp-bg-color-dark-90">
477477
<div class="row">
478478
<div class="col-12">
479-
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2024 Clivern. All rights Reserved" %></p>
479+
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2025 Clivern. All rights Reserved" %></p>
480480
</div>
481481
</div>
482482
</footer>

lib/lynx_web/templates/page/settings.html.heex

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<div class="col hp-flex-none w-auto hp-horizontal-block">
1414
<div class="hp-header-logo d-flex align-items-end">
15-
<a href={Routes.page_path(@conn, :projects)}>
15+
<a href={Routes.page_path(@conn, :settings)}>
1616
<img class="hp-logo hp-sidebar-visible" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
1717
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-none" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
1818
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-block" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
@@ -291,7 +291,7 @@
291291
<footer class="w-100 py-18 px-16 py-sm-24 px-sm-32 hp-bg-color-black-20 hp-bg-color-dark-90">
292292
<div class="row">
293293
<div class="col-12">
294-
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2024 Clivern. All rights Reserved" %></p>
294+
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2025 Clivern. All rights Reserved" %></p>
295295
</div>
296296
</div>
297297
</footer>

lib/lynx_web/templates/page/snapshots.html.heex

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<div class="col hp-flex-none w-auto hp-horizontal-block">
3030
<div class="hp-header-logo d-flex align-items-end">
31-
<a href={Routes.page_path(@conn, :projects)}>
31+
<a href={Routes.page_path(@conn, :snapshots)}>
3232
<img class="hp-logo hp-sidebar-visible" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
3333
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-none" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
3434
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-block" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
@@ -506,7 +506,7 @@
506506
<footer class="w-100 py-18 px-16 py-sm-24 px-sm-32 hp-bg-color-black-20 hp-bg-color-dark-90">
507507
<div class="row">
508508
<div class="col-12">
509-
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2024 Clivern. All rights Reserved" %></p>
509+
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2025 Clivern. All rights Reserved" %></p>
510510
</div>
511511
</div>
512512
</footer>

lib/lynx_web/templates/page/teams.html.heex

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<div class="col hp-flex-none w-auto hp-horizontal-block">
2525
<div class="hp-header-logo d-flex align-items-end">
26-
<a href={Routes.page_path(@conn, :projects)}>
26+
<a href={Routes.page_path(@conn, :teams)}>
2727
<img class="hp-logo hp-sidebar-visible" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
2828
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-none" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
2929
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-block" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
@@ -475,7 +475,7 @@
475475
<footer class="w-100 py-18 px-16 py-sm-24 px-sm-32 hp-bg-color-black-20 hp-bg-color-dark-90">
476476
<div class="row">
477477
<div class="col-12">
478-
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2024 Clivern. All rights Reserved" %></p>
478+
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2025 Clivern. All rights Reserved" %></p>
479479
</div>
480480
</div>
481481
</footer>

lib/lynx_web/templates/page/users.html.heex

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<div class="col hp-flex-none w-auto hp-horizontal-block">
2525
<div class="hp-header-logo d-flex align-items-end">
26-
<a href={Routes.page_path(@conn, :projects)}>
26+
<a href={Routes.page_path(@conn, :users)}>
2727
<img class="hp-logo hp-sidebar-visible" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
2828
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-none" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
2929
<img class="hp-logo hp-sidebar-hidden hp-dir-none hp-dark-block" src={Routes.static_path(@conn, "/images/ico.png")} alt="logo">
@@ -449,7 +449,7 @@
449449
<footer class="w-100 py-18 px-16 py-sm-24 px-sm-32 hp-bg-color-black-20 hp-bg-color-dark-90">
450450
<div class="row">
451451
<div class="col-12">
452-
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2024 Clivern. All rights Reserved" %></p>
452+
<p class="hp-badge-text fw-semibold mb-0 text-center text-sm-start hp-text-color-dark-30"><%= gettext "Copyright © 2025 Clivern. All rights Reserved" %></p>
453453
</div>
454454
</div>
455455
</footer>

lib/lynx_web/views/lock_view.ex

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ defmodule LynxWeb.LockView do
1010
"""
1111
def render("lock_data.json", %{lock: lock}) do
1212
%{
13-
ID: lock.tf_uuid,
14-
Path: lock.tf_path,
15-
Operation: lock.tf_operation,
16-
Who: lock.tf_who,
17-
Version: lock.tf_version,
13+
ID: lock.uuid,
14+
Path: lock.path,
15+
Operation: lock.operation,
16+
Who: lock.who,
17+
Version: lock.version,
1818
Created: lock.updated_at,
19-
Info: lock.tf_info
19+
Info: lock.info
2020
}
2121
end
2222

lib/lynx_web/views/state_view.ex

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ defmodule LynxWeb.StateView do
1010
"""
1111
def render("lock_data.json", %{lock: lock}) do
1212
%{
13-
ID: lock.tf_uuid,
14-
Path: lock.tf_path,
15-
Operation: lock.tf_operation,
16-
Who: lock.tf_who,
17-
Version: lock.tf_version,
13+
ID: lock.uuid,
14+
Path: lock.path,
15+
Operation: lock.operation,
16+
Who: lock.who,
17+
Version: lock.version,
1818
Created: lock.updated_at,
19-
Info: lock.tf_info
19+
Info: lock.info
2020
}
2121
end
2222

mix.exs

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
defmodule Lynx.MixProject do
66
use Mix.Project
77

8-
@version "0.12.7"
8+
@version "0.12.8"
99

1010
def get_version, do: @version
1111

@@ -57,7 +57,8 @@ defmodule Lynx.MixProject do
5757
{:gettext, "~> 0.25"},
5858
{:jason, "~> 1.4"},
5959
{:plug_cowboy, "~> 2.5"},
60-
{:bcrypt_elixir, "~> 3.0"}
60+
{:bcrypt_elixir, "~> 3.0"},
61+
{:sleeplocks, "~> 1.0"}
6162
]
6263
end
6364

0 commit comments

Comments
 (0)