Skip to content

Commit

Permalink
Init release
Browse files Browse the repository at this point in the history
  • Loading branch information
mighty-sponge committed Oct 4, 2023
0 parents commit 8db457a
Show file tree
Hide file tree
Showing 44 changed files with 980 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "CLA Check"
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened,closed,synchronize]

permissions:
actions: write
contents: write
pull-requests: write
statuses: write

jobs:
cla-check:
uses: anyproto/open/.github/workflows/cla.yml@main
secrets: inherit
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: release

permissions: write-all

jobs:
create_release:
name: create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Any Association

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Ansible-anysync

- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installing](#installing)
- [Usage](#usage)
- [Contribution](#contribution)

## Getting Started

Ansible role for any-sync daemons. Currently, this works on Debian and RHEL based linux systems. Tested platforms are:
* Ubuntu 22.04
* Amazon Linux 2

You can read the documentation on using any-sync [here](https://tech.anytype.io/).

### Prerequisites

* Minimum Ansible version of 2.10.0 is installed to execute these roles
* Redis
* MongoDB
* S3 object storage (this repository features integration with aws s3)

### Installing

Clone the current repository with roles

```
git clone https://github.com/anyproto/ansible-anysync.git
```

Use in a playbook:

```yaml
- hosts: someserversgroup
become: yes
roles:
- any-sync-coordinator
- any-sync-consensusnode
- any-sync-filenode
- any-sync-node
```
## Usage
Look to the defaults properties file in `any-sync-*/defaults/main.yml` to see the possible configuration properties.

**You need to customize the default template for sections "account" and "network" in `defaults/main.yml` directory of each role:**
```yaml
account:
peerId: CHANGE_ME
peerKey: CHANGE_ME
signingKey: CHANGE_ME
```
```yaml
network:
networkId: CHANGE_ME
nodes:
- peerId: CHANGE_ME
addresses:
- CHANGE_ME:443
types:
- tree
...
```
⚠️ Use [any-sync-tools](https://github.com/anyproto/any-sync-tools) to generate this configuration.

## Contribution
Thank you for your desire to develop Anytype together!

❤️ This project and everyone involved in it is governed by the [Code of Conduct](https://github.com/anyproto/.github/blob/main/docs/CODE_OF_CONDUCT.md).

🧑‍💻 Check out our [contributing guide](https://github.com/anyproto/.github/blob/main/docs/CONTRIBUTING.md) to learn about asking questions, creating issues, or submitting pull requests.

🫢 For security findings, please email [[email protected]](mailto:[email protected]) and refer to our [security guide](https://github.com/anyproto/.github/blob/main/docs/SECURITY.md) for more information.

🤝 Follow us on [Github](https://github.com/anyproto) and join the [Contributors Community](https://github.com/orgs/anyproto/discussions).

---
Made by Any — a Swiss association 🇨🇭

Licensed under [MIT](./LICENSE.md).
5 changes: 5 additions & 0 deletions any-sync-consensusnode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: any_sync_consensusnode
become: yes
roles:
- any-sync-consensusnode
5 changes: 5 additions & 0 deletions any-sync-coordinator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: any_sync_coordinator
become: yes
roles:
- any-sync-coordinator
5 changes: 5 additions & 0 deletions any-sync-filenode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: any_sync_filenode
become: yes
roles:
- any-sync-filenode
6 changes: 6 additions & 0 deletions any-sync-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: any_sync_node[0]
become: yes
#user: ec2-user
roles:
- any-sync-node
66 changes: 66 additions & 0 deletions group_vars/any_sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
any_sync_accounts:
any-sync-node1:
peerId: 12D3KooWLTVK3VgXziU8ZcvvHUebueSBPiJNjXBxm3DQWtqsCbWD
peerKey: <change me>
signingKey: <change me>
any-sync-node2:
peerId: 12D3KooWBTWo5KVveQuVEA4VeivgbS7LxGkTgmWspEtpaw3D5xXw
peerKey: <change me>
signingKey: <change me>
any-sync-node3:
peerId: 12D3KooWF8HJnjL8MDUAExyg7yEAXhcXKzMwsn3dvivDjKWe7NN5
peerKey: <change me>
signingKey: <change me>
any-sync-filenode1:
peerId: 12D3KooWBjzGAnG3Xk8x2PPsCS6z2Hm1gE23NVnmNQEXcDqS7b8A
peerKey: <change me>
signingKey: <change me>
any-sync-coordinator1:
peerId: 12D3KooWAiMEfdAdr3t5JnXBxnDfbsX3pN1FvULz8FFWeN1WMSS
peerKey: <change me>
signingKey: <change me>
any-sync-consensusnode1:
peerId: 12D3KooWLjZqEbB2sMyqVXZYnhRPR9NvWuRzNUJ4XFi9mY8QKcG
peerKey: <change me>
signingKey: <change me>

any_sync_network:
networkId: N5787WrcATL3f9kDUVxz9yeexEoxxmBLQRhJ47SBNBXEhadc
nodes:
- peerId: 12D3KooWLTVK3VgXziU8ZcvvHUebueSBPiJNjXBxm3DQWtqsCbWD
addresses:
- any-sync-node1:443
- quic://nany-sync-node1:5430
types:
- tree
- peerId: 12D3KooWBTWo5KVveQuVEA4VeivgbS7LxGkTgmWspEtpaw3D5xXw
addresses:
- any-sync-node2:443
- quic://any-sync-node2:5430
types:
- tree
- peerId: 12D3KooWF8HJnjL8MDUAExyg7yEAXhcXKzMwsn3dvivDjKWe7NN5
addresses:
- any-sync-node3:443
- quic://any-sync-node3:5430
types:
- tree
- peerId: 12D3KooWBjzGAnG3Xk8x2PPsCS6z2Hm1gE23NVnmNQEXcDqS7b8A
addresses:
- any-sync-filenode1:443
- quic://any-sync-filenode1:5430
types:
- file
- peerId: 12D3KooWAiMEfdAdr3t5JnXBxnDfbsX3pN1FvULz8FFWeN1WMSS
addresses:
- any-sync-coordinator1:443
- quic://any-sync-coordinator1:5430
types:
- coordinator
- peerId: 12D3KooWLjZqEbB2sMyqVXZYnhRPR9NvWuRzNUJ4XFi9mY8QKcG
addresses:
- any-sync-consensusnode1:443
- quic://any-sync-consensusnode1:5430
types:
- consensus
22 changes: 22 additions & 0 deletions inventory.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[all:children]
any_sync

[any_sync_node]
any-sync-node1 ansible_host=ansible-any-sync-node1.toolpad.org
any-sync-node2 ansible_host=ansible-any-sync-node2.toolpad.org
any-sync-node3 ansible_host=ansible-any-sync-node3.toolpad.org

[any_sync_filenode]
any-sync-filenode1 ansible_host=ansible-any-sync-filenode1.toolpad.org

[any_sync_coordinator]
any-sync-coordinator1 ansible_host=ansible-any-sync-coordinator1.toolpad.org

[any_sync_consensusnode]
any-sync-consensusnode1 ansible_host=ansible-any-sync-consensusnode1.toolpad.org

[any_sync:children]
any_sync_node
any_sync_filenode
any_sync_coordinator
any_sync_consensusnode
50 changes: 50 additions & 0 deletions roles/any-sync-consensusnode/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# user and group that the any_sync_consensusnode service will run as
any_sync_consensusnode_user: any-sync-consensusnode
any_sync_consensusnode_group: any-sync-consensusnode

any_sync_consensusnode_version: 0.1.1
any_sync_consensusnode_release_system: x86_64 # aarch64.rpm x86_64.rpm amd64.deb arm64.deb
any_sync_consensusnode_release_name_rhel: "any-sync-consensusnode-{{ any_sync_consensusnode_version }}-1.{{ any_sync_consensusnode_release_system }}.rpm"
any_sync_consensusnode_download_url_rhel: "https://github.com/anyproto/any-sync-consensusnode/releases/download/v{{ any_sync_consensusnode_version}}/{{ any_sync_consensusnode_release_name_rhel }}"

any_sync_consensusnode_release_name_debian: "any-sync-consensusnode_{{ any_sync_consensusnode_version }}_{{ any_sync_consensusnode_release_system }}.deb"
any_sync_consensusnode_download_url_debian: "https://github.com/anyproto/any-sync-consensusnode/releases/download/v{{ any_sync_consensusnode_version}}/{{ any_sync_consensusnode_release_name_debian }}"

# any sync consensusnode configuration
# see: https://github.com/anyproto/any-sync-consensusnode/blob/main/etc/any-sync-consensusnode.yml
any_sync_consensusnode_config_path: /etc/any-sync-consensusnode
any_sync_consensusnode_networkStorePath: /var/lib/any-sync-consensusnode/networkStore
any_sync_consensusnode_config:
apiServer:
server:
listenAddrs:
- "{{ ansible_host }}:8080"
stream:
maxMsgSizeMb: 256
timeoutMilliseconds: 1000
drpc:
stream:
maxMsgSizeMb: 256
timeoutMilliseconds: 1000
log:
defaultLevel: ''
namedLevels: {}
production: false
mongo:
connect: mongodb://any-sync-mongodb1:27017,any-sync-mongodb2:27017,any-sync-mongodb3:27017/?w=majority
database: consensus
logCollection: log
metric:
addr: 0.0.0.0:8000
yamux:
dialTimeoutSec: 10
listenAddrs:
- "{{ ansible_host }}:443"
writeTimeoutSec: 10
quic:
dialTimeoutSec: 10
listenAddrs:
- "{{ ansible_host }}:5430"
writeTimeoutSec: 10
networkStorePath: "{{ any_sync_consensusnode_networkStorePath }}"
6 changes: 6 additions & 0 deletions roles/any-sync-consensusnode/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Restart any-sync-consensusnode
systemd:
name: any-sync-consensusnode
daemon_reload: yes
state: restarted
24 changes: 24 additions & 0 deletions roles/any-sync-consensusnode/tasks/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---

- name: Ensure config path
file:
path: "{{ item }}"
state: directory
mode: 0755
owner: "{{ any_sync_consensusnode_user }}"
group: "{{ any_sync_consensusnode_group }}"
with_items:
- "{{ any_sync_consensusnode_config_path }}"
- "{{ any_sync_consensusnode_networkStorePath }}"

- name: Copy config file
template:
src: config.yml.j2
dest: "{{ any_sync_consensusnode_config_path }}/config.yml"
notify: Restart any-sync-consensusnode

- name: Copy systemd init file
template:
src: service.j2
dest: /etc/systemd/system/any-sync-consensusnode.service
notify: Restart any-sync-consensusnode
21 changes: 21 additions & 0 deletions roles/any-sync-consensusnode/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Ensure group
group:
name: "{{ any_sync_consensusnode_group }}"
state: present

- name: Сreate a user
user:
name: "{{ any_sync_consensusnode_user }}"
group: "{{ any_sync_consensusnode_group }}"
state: present

- name: Remote RPM install with yum
yum:
name: "{{ any_sync_consensusnode_download_url_rhel }}"
when: ansible_os_family == 'RedHat'

- name: Remote DEB install with apt
apt:
deb: "{{ any_sync_consensusnode_download_url_debian }}"
when: ansible_os_family == 'Debian'
16 changes: 16 additions & 0 deletions roles/any-sync-consensusnode/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

- name: Install
import_tasks: install.yml
tags:
- install

- name: Configure
import_tasks: config.yml
tags:
- configure

- name: Service
import_tasks: service.yml
tags:
- service
Loading

0 comments on commit 8db457a

Please sign in to comment.