Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Mar 25, 2024
1 parent 97945eb commit 02b8601
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 276 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ lynx_dev*
.env.*
.env

example/hello.txt
example/hello.txt

.vagrant
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Lynx is a Fast, Secure and Reliable Terraform Backend. It is built in Elixir wit

### Docker Deployment

To run with docker and docker-compose
1. To run with docker and docker-compose. Make sure you update `server_name` in `nginx.conf` file.

```zsh
$ git clone https://github.com/Clivern/Lynx.git app
Expand Down
71 changes: 71 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/jammy64"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 8000, host: 8000, host_ip: "127.0.0.1"

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.

# Enable provisioning with a shell script. Additional provisioners such as
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
apt-get update -y
apt-get upgrade -y
#apt-get install docker.io
SHELL
end
42 changes: 42 additions & 0 deletions lib/lynx/model/task.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

defmodule Lynx.Model.Task do
@moduledoc """
Task Model
"""

use Ecto.Schema
import Ecto.Changeset

schema "tasks" do
field :uuid, Ecto.UUID
field :payload, :string
field :result, :string
# :pending, running, success, failure, skipped
field :status, :string
field :run_at, :utc_datetime

timestamps()
end

@doc false
def changeset(task, attrs) do
task
|> cast(attrs, [
:uuid,
:payload,
:result,
:status,
:run_at
])
|> validate_required([
:uuid,
:payload,
:result,
:status,
:run_at
])
end
end
35 changes: 35 additions & 0 deletions lib/lynx/model/task_meta.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

defmodule Lynx.Model.TaskMeta do
@moduledoc """
TaskMeta Model
"""

use Ecto.Schema
import Ecto.Changeset

schema "tasks_meta" do
field :key, :string
field :value, :string
field :task_id, :id

timestamps()
end

@doc false
def changeset(meta, attrs) do
meta
|> cast(attrs, [
:key,
:value,
:task_id
])
|> validate_required([
:key,
:value,
:task_id
])
end
end
11 changes: 11 additions & 0 deletions lib/lynx_web/controllers/snapshot_controller.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

defmodule LynxWeb.SnapshotController do
@moduledoc """
Snapshot Controller
"""

use LynxWeb, :controller
end
21 changes: 21 additions & 0 deletions priv/repo/migrations/20230305002634_create_tasks.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

defmodule Lynx.Repo.Migrations.CreateTasks do
use Ecto.Migration

def change do
create table(:tasks) do
add :uuid, :uuid
add :payload, :string
add :result, :string
add :status, :string
add :run_at, :utc_datetime

timestamps()
end

create index(:tasks, [:uuid])
end
end
20 changes: 20 additions & 0 deletions priv/repo/migrations/20230305002635_create_tasks_meta.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

defmodule Lynx.Repo.Migrations.CreateTasksMeta do
use Ecto.Migration

def change do
create table(:tasks_meta) do
add :key, :string
add :value, :text
add :task_id, references(:tasks, on_delete: :delete_all)

timestamps()
end

create index(:tasks_meta, [:key])
create index(:tasks_meta, [:task_id])
end
end
148 changes: 0 additions & 148 deletions techstack.md

This file was deleted.

Loading

0 comments on commit 02b8601

Please sign in to comment.