Skip to content

Commit

Permalink
Merge pull request sandwichfarm#20 from dskvr/feature/ci
Browse files Browse the repository at this point in the history
CI/CD
  • Loading branch information
dskvr authored Dec 17, 2022
2 parents f23cdf5 + 2d1a377 commit 6ac8f66
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 12 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build & Deploy
on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Yarn Install
run: yarn install

- name: Docker Build & tag
run: |
yarn docker:build
yarn docker:tag
- name: Configure doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Login to doctl registry
run: doctl registry login -t ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Docker Deploy
run: |
yarn docker:deploy
- name: Pull new image and restart
uses: appleboy/[email protected]
with:
host: ${{secrets.SSH_DEPLOY_HOST}}
key: ${{secrets.SSH_DEPLOY_KEY}}
username: ${{ secrets.SSH_DEPLOY_USERNAME }}
script: docker pull registry.digitalocean.com/sandwich-farm/nostr-relay-status:latest && docker-compose stop && docker-compose up -d
Empty file.
21 changes: 21 additions & 0 deletions .github/workflows/test-relay.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test Relay
on:
pull_request:
paths:
- 'relays.yaml'

jobs:
check_relay:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
+(src|__tests__)/**/*.ts
!src/exclude.ts
FILES: |
relays.yml
- name: Check differences
run: echo ${{ env.GIT_DIFF }}
2 changes: 2 additions & 0 deletions nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
server {
listen 80;
root /app;
error_page 404 =200 /index.html;

location / {
index index.html;
# try_files $uri $uri/ /index.html;
}

location ~ /?(.*)$ {

index index.html;
}
}
4 changes: 2 additions & 2 deletions relays.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
relays:
# - 'wss://rsslay.fiatjaf.com'
- 'wss://rsslay.fiatjaf.com'
- 'wss://relayer.fiatjaf.com'
- 'wss://freedom-relay.herokuapp.com/ws'
- 'wss://nostr-relay.freeberty.net'
- 'wss://nostr-relay.wlvs.space'
Expand All @@ -26,7 +27,6 @@ relays:
- 'wss://relay.grunch.dev'
- 'wss://relay.cynsar.foundation'
- 'wss://nostr-pub.wellorder.net'
# - 'wss://relayer.fiatjaf.com'
- 'wss://relay.oldcity-bitcoiners.info'
- 'wss://relay.bitid.nz'
- 'wss://relay.nostr.xyz'
Expand Down
7 changes: 7 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<router-view></router-view>
<a id="fork-me" href="https://github.com/dskvr/nostr-watch"><img decoding="async" loading="lazy" width="149" height="149" src="https://github.blog/wp-content/uploads/2008/12/forkme_right_darkblue_121621.png?resize=149%2C149" class="attachment-full size-full" alt="Fork me on GitHub" data-recalc-dims="1"></a>
</template>

<script>
Expand All @@ -18,4 +19,10 @@ export default {
text-align: center;
color: #2c3e50;
}
#fork-me {
position:absolute;
top: 0px;
right:0px;
z-index: 9999;
}
</style>
1 change: 1 addition & 0 deletions src/components/NavComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<span>
<PreferencesComponent />
</span>

</ul>
</nav>
</template>
Expand Down
28 changes: 18 additions & 10 deletions src/components/RefreshComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ const localMethods = {
nextRefresh: function(){
return this.timeSince(Date.now()-(this.lastUpdate+this.preferences.cacheExpiration-Date.now()))
},
setRefreshInterval: function(){
this.interval = setInterval(() => {
if(!this.preferences.refresh) return false
this.preferences = this.getState('preferences') || this.preferences
this.refreshData.untilNext = this.timeUntilRefresh()
this.refreshData.sinceLast = this.timeSinceRefresh()
if(this.isExpired())
this.invalidate()
}, 1000)
}
}
export default defineComponent({
Expand All @@ -40,16 +53,8 @@ export default defineComponent({
sinceLast: this.timeSinceRefresh()
})
setInterval(() => {
this.preferences = this.getState('preferences') || this.preferences
this.refreshData.untilNext = this.timeUntilRefresh()
this.refreshData.sinceLast = this.timeSinceRefresh()
if(this.isExpired())
this.invalidate()
}, 1000)
if(this.preferences.refresh)
this.setRefreshInterval()
},
updated(){
this.saveState('preferences')
Expand All @@ -61,6 +66,9 @@ export default defineComponent({
this.refreshData.untilNext = this.timeUntilRefresh()
this.refreshData.sinceLast = this.timeSinceRefresh()
if(this.preferences.refresh)
this.setRefreshInterval()
},
computed: {},
methods: Object.assign(localMethods, sharedMethods),
Expand Down

0 comments on commit 6ac8f66

Please sign in to comment.