Skip to content

Commit

Permalink
Merge pull request #4314 from thematters/develop
Browse files Browse the repository at this point in the history
Release: v5.9.2
  • Loading branch information
gitwoz authored Feb 27, 2025
2 parents 555ee58 + c4b02a9 commit 5d5674d
Show file tree
Hide file tree
Showing 52 changed files with 599 additions and 2,741 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.git
# Elastic Beanstalk Files
.elasticbeanstalk/*
.git
.gitignore
.github
.vscode
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MATTERS_AWS_ARCHIVE_USER_QUEUE_URL="https://sqs.ap-southeast-1.amazonaws.com/903
MATTERS_AWS_LIKECOIN_LIKE_QUEUE_URL="https://sqs.ap-southeast-1.amazonaws.com/903380195283/likecoin-like-dev.fifo"
MATTERS_AWS_LIKECOIN_SEND_PV_QUEUE_URL=""
MATTERS_AWS_LIKECOIN_UPDATE_CIVIC_LIKER_CACHE_QUEUE_URL="https://sqs.ap-southeast-1.amazonaws.com/903380195283/likecoin-update-civic-liker-cache-dev"
MATTERS_AWS_IPNS_USER_PUBLICATION_QUEUE_URL="https://sqs.ap-southeast-1.amazonaws.com/903380195283/ipns-user-publication-dev"
MATTERS_AWS_IPFS_PUBLICATION_QUEUE_URL="https://sqs.ap-southeast-1.amazonaws.com/903380195283/ipfs-publication-dev"

MATTERS_PG_HOST=db
MATTERS_PG_USER=postgres
Expand All @@ -45,8 +45,6 @@ MATTERS_MATTY_ID=6
MATTERS_MATTY_CHOICE_TAG_ID=3906
MATTERS_EMAIL_FROM_ASK=Matters<ask@matters.town>

MATTERS_IPFS_SERVERS="http://ipfs.dev.vpc:5001, http://10.0.0.169:5001"

MATTERS_SENTRY_DSN=
MATTERS_OICD_PRIVATE_KEY=.ebextensions/oicd_rsa_private_local.pem
MATTERS_LIKECOIN_OAUTH_CLIENT_NAME=LikeCoin
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,13 @@ jobs:
image: redis
ports:
- 6379:6379
ipfs:
image: ipfs/go-ipfs:v0.14.0
ports:
- 5001:5001
stripe:
image: stripemock/stripe-mock:latest
ports:
- 12111:12111
- 12112:12112
postgres:
image: postgres:12-alpine
image: postgres:15
ports:
- 5432:5432
env:
Expand Down Expand Up @@ -168,7 +164,7 @@ jobs:
- name: Build, tag, and push image to Amazon ECR (develop)
if: github.base_ref == 'develop'
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f docker/Dockerfile .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
Expand Down Expand Up @@ -206,7 +202,7 @@ jobs:
- name: Build, tag, and push image to Amazon ECR (stage)
if: github.base_ref == 'stage'
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f docker/Dockerfile .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
Expand Down Expand Up @@ -273,7 +269,7 @@ jobs:
ECR_REPOSITORY: matters-server
IMAGE_TAG: prod
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f docker/Dockerfile .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Deploy to EB (production)
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ jobs:
image: redis
ports:
- 6379:6379
ipfs:
image: ipfs/go-ipfs:v0.14.0
ports:
- 5001:5001
stripe:
image: stripemock/stripe-mock:latest
ports:
- 12111:12111
- 12112:12112
postgres:
image: postgres:12-alpine
image: postgres:15
ports:
- 5432:5432
env:
Expand Down
Empty file modified .husky/pre-commit
100755 → 100644
Empty file.
4 changes: 0 additions & 4 deletions .husky/prepare-commit-msg

This file was deleted.

1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1

FROM node:18-alpine AS base

# install os level packages
RUN apk add --no-cache \
# PostgreSQL client library
libpq

# install dependencies
WORKDIR /var/app
EXPOSE 4000

COPY package*.json ./
RUN npm install
USER node
COPY . .
ENV NODE_OPTIONS="--no-experimental-fetch"
CMD npm run start
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
### Docker

- `cp .env.example .env`
- `docker-compose -f docker/docker-compose.yml build`
- `docker-compose -f docker/docker-compose.yml run app npm run db:rollback`
- `docker-compose -f docker/docker-compose.yml run app npm run db:migrate`
- `docker-compose -f docker/docker-compose.yml run app npm run db:seed`
- `docker-compose -f docker/docker-compose.yml up`
- Run test cases: `docker-compose -f docker/docker-compose.yml run app npm run test`
- Init search indices: `docker-compose -f docker/docker-compose.yml run app npm run search:init`
- `docker compose build`
- `docker compose run app npm run db:rollback`
- `docker compose run app npm run db:migrate`
- `docker compose run app npm run db:seed`
- `docker compose up`
- Run test cases: `docker compose run app npm run test`
- Init search indices: `docker compose run app npm run search:init`

## DB migrations and seeds

Expand Down
19 changes: 4 additions & 15 deletions docker/docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
version: '3'

services:
app:
container_name: api
image: matters-server:latest
build:
context: ../
dockerfile: docker/Dockerfile
context: .
command: ['npm', 'run', 'start:dev']
env_file: ../.env
env_file: .env
volumes:
- ..:/var/app
- .:/var/app
- /var/app/node_modules
depends_on:
- db
- redis
- s3
- ipfs
- stripe
ports:
- '4000:4000'
db:
image: postgres:12
image: postgres:15
container_name: db
environment:
- POSTGRES_DB=matters-dev
Expand All @@ -41,13 +37,6 @@ services:
image: lphoward/fake-s3
ports:
- '4569:4569'
ipfs:
container_name: ipfs
image: ipfs/go-ipfs:v0.14.0
ports:
- '8080:8080'
- '4001:4001'
- '5001:5001'
stripe:
container_name: stripe
image: stripemock/stripe-mock:latest
Expand Down
14 changes: 14 additions & 0 deletions db/migrations/20250220105906_add_campaign_featured_description.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const table = 'campaign'
const column = 'featured_description'

exports.up = async (knex) => {
await knex.schema.table(table, (t) => {
t.text(column).notNullable().defaultTo('')
})
}

exports.down = async (knex) => {
await knex.schema.table(table, (t) => {
t.dropColumn(column)
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const table = 'user_reader_materialized'

exports.up = async (knex) => {
await knex.schema.table(table, (t) => {
t.index(['state', 'user_name'])
t.index(['author_score', 'id'])
})
}

exports.down = async (knex) => {
await knex.schema.table(table, (t) => {
t.dropIndex(['state', 'user_name'])
t.dropIndex(['author_score', 'id'])
})
}
16 changes: 0 additions & 16 deletions docker/Dockerfile

This file was deleted.

Loading

0 comments on commit 5d5674d

Please sign in to comment.