Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat migrate to Nuxt3 #371

Closed
wants to merge 61 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
1bfa6a8
feat(api): add ten.testnet
guidiaz Feb 9, 2024
5460768
chore(ui): add svg for TEN ecosystem
guidiaz Feb 9, 2024
93d2c13
chore(api): add hk$/usd to conflux.espace.testnet
guidiaz Feb 23, 2024
7410952
feat(ui): add HK$ svg
guidiaz Feb 26, 2024
c12e61f
chore: refactor hk$ -> hkd
guidiaz Feb 26, 2024
59efbba
fix(api): set up block explorer on ten.testnet
guidiaz Feb 26, 2024
93c943b
chore(api): add optimism.sepolia pfs
guidiaz Mar 5, 2024
26e9751
fix: adjust ten icon size
gabaldon Mar 5, 2024
938c963
chore: update ci files with new workflows
aeweda Mar 8, 2024
5a1a5c1
chore: isolate caddy in it's own stack
aeweda Mar 8, 2024
b45452a
chore: add caddy ansible script to workflow files
aeweda Mar 8, 2024
7d11703
chore: update all ansible scripts to reflect different environments
aeweda Mar 8, 2024
5eda1d3
chore: update ci workflows naming
aeweda Mar 8, 2024
afff541
chore: release to productions on tag
aeweda Mar 8, 2024
36647bf
chore: fix caddy deployment
aeweda Mar 8, 2024
581fc3c
chore: fix docker-compose file typo
aeweda Mar 8, 2024
e80d453
chore: replace loki url
aeweda Mar 8, 2024
12a1599
chore: globalize stacks network
aeweda Mar 8, 2024
4ee2229
chore: add global swarm docker network
aeweda Mar 8, 2024
9fce221
fix: typos
aeweda Mar 8, 2024
089bdb9
chore: rename stack
aeweda Mar 8, 2024
6aa705d
fix: typo
aeweda Mar 8, 2024
f434d97
fix typo in CI vars
aeweda Mar 8, 2024
0f6a479
chore: update caddy version
aeweda Mar 8, 2024
bee246a
chore: revamp deployment in a single stack for dns resolution
aeweda Mar 8, 2024
0126a93
fix: envars copying and naming
aeweda Mar 8, 2024
8783631
chore: update action version
aeweda Mar 8, 2024
f11c8f7
fix: typos in playbook
aeweda Mar 8, 2024
4815b8d
chore: pull images for faster builds
aeweda Mar 8, 2024
873b889
fix: .env placement
aeweda Mar 8, 2024
7464ea7
chore: add production image tags
aeweda Mar 8, 2024
40a4602
chore: remove useless file
aeweda Mar 8, 2024
832de91
chore: add missing gettag steps
aeweda Mar 8, 2024
ee91d76
chore: fix broken envar generation
aeweda Mar 8, 2024
b50799e
chore: fix typo and update action version
aeweda Mar 8, 2024
fccb034
fix: typo for staging env
aeweda Mar 8, 2024
a4aea15
fix: caddyfile path
aeweda Mar 8, 2024
144aaff
chore: fix api endpoint replacement
aeweda Mar 8, 2024
edb71f7
bump version v1.1.0
Tommytrg Mar 8, 2024
2df9be5
fix: image pull command
aeweda Mar 8, 2024
da1b2f1
chore(api): settle optimism:sepolia to legacy router address
guidiaz Mar 19, 2024
17cabb7
chore: bump v1.1.0
Tommytrg Mar 19, 2024
d601ea1
fix(api): change router addr on optimism:sepolia
guidiaz Mar 20, 2024
1d12e23
bump version v1.1.2
Tommytrg Mar 25, 2024
0d3af93
feat(api): add support for witnetPriceFeeds contract
Tommytrg Jan 17, 2024
de0faef
docs: update readme
Tommytrg Feb 22, 2024
791ac4f
ci: use node 16
Tommytrg Apr 4, 2024
0a85083
feat(api): add support for witnetPriceFeeds contract
Tommytrg Jan 17, 2024
607f88a
feat: migrate ui package to nuxt3
gabaldon Feb 22, 2024
942b9a8
fix: avoid duplicate calls when fetching networks
gabaldon Feb 22, 2024
a7f55dc
fix(types): add correct typing
gabaldon Feb 22, 2024
58c0017
fix: make linter work from root workspace
gabaldon Feb 26, 2024
0c9c9d7
fix: make linter work from root workspace
gabaldon Feb 26, 2024
0e8ac93
fix(style): lint changes
gabaldon Feb 26, 2024
3fe0ead
fix: update locale route in crowdin
gabaldon Feb 26, 2024
206c68f
fix: use pnpm in ci and fix types
gabaldon Feb 27, 2024
9aae791
fix: get ecosystem network on reload
gabaldon Mar 26, 2024
a1b9f7a
fix(style): update text colors
gabaldon Mar 26, 2024
cc410de
fix(style): add page transition
gabaldon Mar 26, 2024
35cda9c
wip
gabaldon Apr 4, 2024
1595888
wip
gabaldon Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run lint, test and build
name: Lint, Test and Build

env:
CI: true
Expand All @@ -11,21 +11,22 @@ jobs:

steps:
- uses: actions/checkout@v3

- uses: actions/[email protected]
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: '14'
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: '4.0'
mongodb-port: 27017

- run: yarn
- run: yarn bootstrap
- run: yarn lint:check

- run: yarn test

- run: yarn build

- run: pnpm install
- run: pnpm lint
- run: pnpm test
- run: pnpm build
75 changes: 75 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Production

on:
push:
tags:
- "**"

jobs:
deploy:
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v4

- name: Login to Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Get the latest tag
id: gettag
run: |
git fetch --tags
echo ::set-output name=TAG::$(git describe --tags $(git rev-list --tags --max-count=1))

- name: Create Deployment Files
shell: bash
env:
LOKI: ${{ secrets.LOKI_URL }}
CADDY: ${{ secrets.CADDY_FILE }}
AINV: ${{ secrets.ANSIBLE_INVENTORY }}
API_ENDPOINT: ${{ secrets.API_ENDPOINT }}
STAGING_API_ENDPOINT: ${{ secrets.STAGING_API_ENDPOINT }}
APKEY: ${{ secrets.ANSIBLE_PRIVATE_KEY }}
ENVARS: ${{ vars.ENVARS }}
run: |
echo "$AINV" > ./ansible/inventory.ini
echo "$APKEY" > ./ansible/key.pem
echo "$CADDY" > ./ansible/Caddyfile
echo "$ENVARS" > ./ansible/production.env
echo "$ENVARS" > ./packages/api/.env
echo "$ENVARS" > ./packages/ui/.env
chmod 400 ./ansible/key.pem
sed -i "s#LOKI-REPLACE-ME#$LOKI#g" ./ansible/docker-compose.yml
sed -i "s#<LATEST_PROD>#${{ steps.gettag.outputs.TAG }}#g" ./ansible/docker-compose.yml
sed -i "s#<PRODUCTION_API_ENDPOINT>#$API_ENDPOINT#g" ./ansible/docker-compose.yml
sed -i "s#<STAGING_API_ENDPOINT>#$STAGING_API_ENDPOINT#g" ./ansible/docker-compose.yml

- name: Pull & Rename Images
run: |
docker pull witnet/data-feed-app-ui:latest
docker pull witnet/data-feed-app-api:latest
docker tag witnet/data-feed-app-ui:latest witnet/data-feed-app-ui:${{github.ref_name}}
docker tag witnet/data-feed-app-api:latest witnet/data-feed-app-api:${{github.ref_name}}

- name: Publish Containers
run: |
docker push witnet/data-feed-app-ui:${{github.ref_name}}
docker push witnet/data-feed-app-api:${{github.ref_name}}

- name: Deploy with Ansible
shell: bash
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
cd ansible
ansible-galaxy install -r requirements.yml
export ANSIBLE_CONFIG=./ansible.cfg
export ANSIBLE_FORCE_COLOR=True
export ANSIBLE_STDOUT_CALLBACK=yaml
export FORCE_COLOR=1
export TERM=xterm-color
ansible-playbook playbook.yml -vv
35 changes: 0 additions & 35 deletions .github/workflows/release.yml

This file was deleted.

29 changes: 20 additions & 9 deletions .github/workflows/main.yml → .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy
name: Staging

on:
workflow_dispatch:
Expand All @@ -9,38 +9,49 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
environment: main
environment: Staging
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Login to Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Get the latest tag
id: gettag
run: |
git fetch --tags
echo ::set-output name=TAG::$(git describe --tags $(git rev-list --tags --max-count=1))

- name: Create Deployment Files
shell: bash
env:
LOKI: ${{ secrets.LOKI_URL }}
CADDY: ${{ secrets.CADDY_FILE }}
AINV: ${{ secrets.ANSIBLE_INVENTORY }}
API_ENDPOINT: ${{ secrets.API_ENDPOINT }}
STAGING_API_ENDPOINT: ${{ secrets.STAGING_API_ENDPOINT }}
APKEY: ${{ secrets.ANSIBLE_PRIVATE_KEY }}
ENVARS: ${{ secrets.ENVIRONMENT_VARIABLES }}
ENVARS: ${{ vars.ENVARS }}
run: |
echo "$ENVARS" > ./ansible/.env
echo "$AINV" > ./ansible/inventory.ini
echo "$APKEY" > ./ansible/key.pem
echo "$ENVARS" > ./packages/ui/.env
echo "$CADDY" > ./ansible/Caddyfile
echo "$ENVARS" > ./ansible/staging.env
echo "$ENVARS" > ./packages/api/.env
echo "$AINV" > ./ansible/inventory.ini
echo "$ENVARS" > ./packages/ui/.env
chmod 400 ./ansible/key.pem
sed -i "s#LOKI-REPLACE-ME#$LOKI#g" ./ansible/docker-compose.yml
sed -i "s#API-REPLACE-ME#$API_ENDPOINT#g" ./ansible/docker-compose.yml
sed -i "s#<LATEST_PROD>#${{ steps.gettag.outputs.TAG }}#g" ./ansible/docker-compose.yml
sed -i "s#<PRODUCTION_API_ENDPOINT>#$API_ENDPOINT#g" ./ansible/docker-compose.yml
sed -i "s#<STAGING_API_ENDPOINT>#$STAGING_API_ENDPOINT#g" ./ansible/docker-compose.yml

- name: Build Containers
run: |
docker pull witnet/data-feed-app-ui:latest
docker pull witnet/data-feed-app-api:latest
docker build -t witnet/data-feed-app-ui:latest -f ./ansible/docker/ui.dockerfile ./packages/ui
docker build -t witnet/data-feed-app-api:latest -f ./ansible/docker/api.dockerfile ./packages/api

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Data Feeds Explorer

## Feeds Configuration File

The configuration file for the monitored networks is located the [API package](https://github.com/witnet/data-feeds-explorer/blob/main/packages/api/src/dataFeedsRouter.json).

The networks still using the old witnet price router are marked using legacy: true in the network configuration. The feeds key consists of a map with the default values of the existing price feeds. According to that, the price feeds deployed using the default configuration have been deleted from the network feeds section. If a feed configuration appears in the network feeds, it will overwrite the default configuration.

All the available price feeds in a network called the supportedFeeds method.
31 changes: 25 additions & 6 deletions ansible/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ networks:

# ? Services
services:
# & Webserver
webserver:
image: caddy:2.5.1
image: caddy:2.7.6
ports:
- target: 80
published: 80
Expand All @@ -31,20 +30,40 @@ services:
- DFE
logging: *default-loki

# ? Staging
# & UI
ui:
sui:
image: witnet/data-feed-app-ui:latest
environment:
API_ENDPOINT: "API-REPLACE-ME"
API_ENDPOINT: "<STAGING_API_ENDPOINT>"
networks:
- DFE
logging: *default-loki

# & API
api:
sapi:
image: witnet/data-feed-app-api:latest
env_file:
- /home/ubuntu/dfe/.env
- /home/ubuntu/dfe/staging.env
networks:
- DFE
logging: *default-loki

# ! Production
# & UI
ui:
image: witnet/data-feed-app-ui:<LATEST_PROD>
environment:
API_ENDPOINT: "<PRODUCTION_API_ENDPOINT>"
networks:
- DFE
logging: *default-loki

# & API
api:
image: witnet/data-feed-app-api:<LATEST_PROD>
env_file:
- /home/ubuntu/dfe/production.env
networks:
- DFE
logging: *default-loki
31 changes: 19 additions & 12 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@
path: /home/ubuntu/dfe
state: directory

- name: Copy .env File
- name: Copy staging.env File
copy:
src: ./.env
dest: /home/ubuntu/dfe/.env
src: ./staging.env
dest: /home/ubuntu/dfe/staging.env
loop: "{{ query('fileglob', './staging.env') }}"

- name: Copy Caddy File
- name: Copy production.env File
copy:
src: ./Caddyfile
dest: /home/ubuntu/dfe/Caddyfile
register: Domain
src: ./production.env
dest: /home/ubuntu/dfe/production.env
loop: "{{ query('fileglob', './production.env') }}"

- name: Copy Docker Swarm Stack File
copy:
src: ./docker-compose.yml
dest: /home/ubuntu/dfe/docker-compose.yml

- name: Copy Caddy File
copy:
src: ./Caddyfile
dest: /home/ubuntu/dfe/Caddyfile
register: Domain

- name: Login Into Docker hub Registry
community.docker.docker_login:
username: "{{ lookup('env','DOCKER_USERNAME') }}"
Expand All @@ -31,23 +38,23 @@
- name: Stack History limit
shell: docker swarm update --task-history-limit 2

- name: Deploy Docker Stack
- name: Deploy Production Stack
shell: |
cd /home/ubuntu/dfe
docker stack deploy -c <(docker-compose config) dfe --with-registry-auth
sleep 60
args:
executable: /bin/bash

- name: Update Webserver in case of DNS change
shell: docker service update --force dfe_webserver
when: Domain.changed

- name: Prune Useless Docker Images
shell: |
docker container prune -f
docker image prune -a -f

- name: Update Webserver in case of DNS change
shell: docker service update --force dfe_webserver
when: Domain.changed

- name: List Images & Containers for SHA256 Comparsion if needed
shell: |
docker image ls
Expand Down
4 changes: 2 additions & 2 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
files:
- source: /packages/ui/locales/en.json
translation: /packages/ui/locales/%two_letters_code%.json
- source: /packages/ui/locales/en-US.json
translation: /packages/ui/locales/%original_file_name%".json
Loading