add docker deployment

This commit is contained in:
Will Murphy 2021-11-01 18:05:14 -05:00
parent 18e0c8d602
commit 927ec5d8b3
10 changed files with 112 additions and 16 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
node_modules
web/node_modules
npm-debug.log
certs
.vscode
web/dist
.env

2
.env.defaults Normal file
View file

@ -0,0 +1,2 @@
DB_NAME=guppe
NODE_ENV=production

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ certs/
.vscode
dump/
logs/
.env

23
Dockerfile Normal file
View file

@ -0,0 +1,23 @@
FROM node:16
# Web clinet installs
WORKDIR /usr/src/guppe/web
COPY ./web/package*.json ./
RUN npm ci
# server installs
WORKDIR /usr/src/guppe
COPY package*.json ./
RUN npm ci
# source
COPY . .
# web client build
WORKDIR /usr/src/guppe/web
RUN npm run build
# entry
WORKDIR /usr/src/guppe
EXPOSE 443 80
CMD [ "node", "index.js" ]

View file

@ -1,21 +1,34 @@
# Current state of guppe
Guppe is a tech demo. It is missing a lot of features, and I am in the process of rewriting it's core code from scratch in the fully-implemented, [modular ActivityPub library activitypub-express](https://github.com/immers-space/activitypub-express). I'll try to keep up with major bugfixes, but I won't be adding any features to guppe until i finish apex and can port guppe over to the new engine.
# Gup.pe
Social groups for the fediverse - making it easy to connect and meet new people based on shared interests without the manipulation of your attention to maximize ad revenue nor the walled garden lock-in of capitalist social media.
This server-2-server ActivityPub implementation adds decentralized, federaded "groups" support across all ActivityPub compliant social media networks. Users join groups by following group-type actors on Guppe servers and contribute to groups by mentioning those same actors in a post. Guppe group actors will automatically forward posts they receive to all group members so that everyone in the group sees any post made to the group. Guppe group actors' profiles (e.g. outboxes) also serve as a group discussion history.
Creation of new groups is automatic, users simply search for or mention a new group and it will be created.
## Tech stack
MEVN: MongoDB, ExpressJS, Vue, NodeJS
Mostly powered by [activitypub-express](https://github.com/immers-space/activitypub-express)
from [Immers Space](https://web.immers.space).
The gup.pe server app, `index.js` is < 200 lines of code,
just adding the auto-create actor, auto-accept follow, and auto-boost from inbox behaviors
to the base apex setup.
There's also an HTML front-end using Vue (`/web`) to display popular groups and provide
fallback user profile discovery.
## Installation
Instructions coming soon.
`Dockerfile` and `docker-compose.yml` are provided for easy install
```
git clone https://github.com/wmurphyrd/guppe.git
cd guppe
cp .env.defaults .env
echo DOMAIN=yourdomain.com >> .env
docker-compose up -d
```
## License
Copyright (c) 2019 William Murphy. Licensed under the AGPL-3
Copyright (c) 2021 William Murphy. Licensed under the AGPL-3

37
docker-compose.yml Normal file
View file

@ -0,0 +1,37 @@
version: "3.8"
services:
guppe:
build: .
restart: unless-stopped
ports:
- 443:443
- 80:80
env_file: '.env'
environment:
DB_URL: 'mongodb://mongodb:27017'
PORT_HTTPS: 443
depends_on:
- mongodb
volumes:
- certs:/root/.small-tech.org/auto-encrypt
# localdev certs
- ./certs:/usr/src/guppe/certs
logging:
driver: local
options:
max-size: '10m'
mongodb:
image: mongo:4.2
restart: unless-stopped
volumes:
- mongo-data:/data/db
logging:
driver: local
options:
max-size: '10m'
volumes:
mongo-data:
certs:

View file

@ -1,3 +1,4 @@
require('dotenv').config()
const path = require('path')
const express = require('express')
const MongoClient = require('mongodb').MongoClient
@ -8,7 +9,7 @@ const history = require('connect-history-api-fallback')
const { onShutdown } = require('node-graceful-shutdown')
const ActivitypubExpress = require('activitypub-express')
const { DOMAIN, KEY_PATH, CERT_PATH, CA_PATH, PORT, PORT_HTTPS, DB_URL, DB_NAME } = require('./config.json')
const { DOMAIN, KEY_PATH, CERT_PATH, CA_PATH, PORT_HTTPS, DB_URL, DB_NAME } = process.env
const app = express()
@ -50,9 +51,6 @@ const apex = ActivitypubExpress({
routes
})
app.set('domain', DOMAIN)
app.set('port', process.env.PORT || PORT)
app.set('port-https', process.env.PORT_HTTPS || PORT_HTTPS)
app.use(morgan(':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status Accepts ":req[accept]" ":referrer" ":user-agent"'))
app.use(express.json({ type: apex.consts.jsonldTypes }), apex)

14
package-lock.json generated
View file

@ -13,6 +13,7 @@
"activitypub-express": "^2.2.1",
"connect-history-api-fallback": "^1.6.0",
"cors": "^2.8.4",
"dotenv": "^10.0.0",
"express": "^4.16.3",
"express-basic-auth": "^1.1.5",
"http-signature": "github:wmurphyrd/node-http-signature#9c02eeb",
@ -1301,6 +1302,14 @@
"node": ">=4"
}
},
"node_modules/dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
"engines": {
"node": ">=10"
}
},
"node_modules/duplexer3": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
@ -7517,6 +7526,11 @@
"is-obj": "^1.0.0"
}
},
"dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
},
"duplexer3": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",

View file

@ -8,6 +8,7 @@
"activitypub-express": "^2.2.1",
"connect-history-api-fallback": "^1.6.0",
"cors": "^2.8.4",
"dotenv": "^10.0.0",
"express": "^4.16.3",
"express-basic-auth": "^1.1.5",
"http-signature": "github:wmurphyrd/node-http-signature#9c02eeb",

View file

@ -10,22 +10,22 @@
"dev": "vue-cli-service build --watch --mode development"
},
"dependencies": {
"@vue/cli-plugin-babel": "^3.11.0",
"@vue/cli-service": "^3.11.0",
"core-js": "^2.6.5",
"vue": "^2.6.10",
"vue-router": "^3.0.3"
"vue-router": "^3.0.3",
"vue-template-compiler": "^2.6.10"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.11.0",
"@vue/cli-plugin-eslint": "^3.11.0",
"@vue/cli-plugin-unit-mocha": "^3.11.0",
"@vue/cli-service": "^3.11.0",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "1.0.0-beta.29",
"babel-eslint": "^10.0.1",
"chai": "^4.1.2",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.10"
"eslint-plugin-vue": "^5.0.0"
},
"eslintConfig": {
"root": true,