more work on testing

This commit is contained in:
Nolan Lawson 2018-02-18 10:42:27 -08:00
parent 6bcbfdc59e
commit 5196109e0c
6 changed files with 68 additions and 75 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ yarn.lock
cypress/screenshots
templates/.*
assets/*.css
/mastodon

33
bin/setup-mastodon.js Normal file
View File

@ -0,0 +1,33 @@
const pify = require('pify')
const exec = require('child-process-promise').exec;
const dir = __dirname
const path = require('path')
const fs = require('fs')
const exists = pify(fs.exists.bind(fs))
const writeFile = pify(fs.writeFile.bind(fs))
const envFile = `
PAPERCLIP_SECRET=foo
SECRET_KEY_BASE=bar
OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar
`
async function main() {
let mastodonDir = path.join(dir, '../mastodon')
if (!(await exists(mastodonDir))) {
await exec(`git clone https://github.com/tootsuite/mastodon "${mastodonDir}"`)
await exec(`git checkout v2.2.0`, {cwd: mastodonDir})
await writeFile(path.join(dir, '../mastodon/.env'), envFile, 'utf8')
}
await exec(`gem install bundler`, {cwd: mastodonDir})
await exec(`gem install foreman`, {cwd: mastodonDir})
await exec(`bundle install`, {cwd: mastodonDir})
await exec(`yarn --pure-lockfile`, {cwd: mastodonDir})
await exec(`foreman start`, {cwd: mastodonDir})
}
main().catch(err => {
console.error(err)
process.exit(1)
})

View File

@ -1,12 +0,0 @@
PAPERCLIP_SECRET=foo
SECRET_KEY_BASE=bar
OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar
#REDIS_HOST=localhost
#REDIS_PORT=6379
DB_HOST=127.0.0.1
DB_NAME=mastodon_dev
DB_USER=mastodon_dev
DB_PASS=mastodon_dev
DB_PORT=5432

View File

@ -1,61 +0,0 @@
version: '3'
services:
db:
restart: always
image: postgres:9.6-alpine
environment:
POSTGRES_USER: mastodon_dev
POSTGRES_PASSWORD: mastodon_dev
POSTGRES_DB: mastodon_dev
### Uncomment to enable DB persistance
# volumes:
# - ./postgres:/var/lib/postgresql/data
redis:
restart: always
image: redis:4.0-alpine
### Uncomment to enable REDIS persistance
# volumes:
# - ./redis:/data
web:
#build: .
image: gargron/mastodon:v2.2.0
restart: always
env_file: .env
command: bundle exec rails s -p 3000 -b '0.0.0.0'
ports:
- "3000:3000"
depends_on:
- db
- redis
volumes:
- ./public/assets:/mastodon/public/assets
- ./public/packs:/mastodon/public/packs
- ./public/system:/mastodon/public/system
streaming:
#build: .
image: gargron/mastodon:v2.2.0
restart: always
env_file: .env
command: npm run start
ports:
- "4000:4000"
depends_on:
- db
- redis
sidekiq:
#build: .
image: gargron/mastodon:v2.2.0
restart: always
env_file: .env
command: bundle exec sidekiq -q default -q mailers -q pull -q push
depends_on:
- db
- redis
volumes:
- ./public/packs:/mastodon/public/packs
- ./public/system:/mastodon/public/system

31
package-lock.json generated
View File

@ -726,6 +726,27 @@
"parse5": "3.0.3"
}
},
"child-process-promise": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/child-process-promise/-/child-process-promise-2.2.1.tgz",
"integrity": "sha1-RzChHvYQ+tRQuPIjx50x172tgHQ=",
"requires": {
"cross-spawn": "4.0.2",
"node-version": "1.1.0",
"promise-polyfill": "6.1.0"
},
"dependencies": {
"cross-spawn": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz",
"integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=",
"requires": {
"lru-cache": "4.1.1",
"which": "1.3.0"
}
}
}
},
"chokidar": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.0.tgz",
@ -5085,6 +5106,11 @@
}
}
},
"node-version": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/node-version/-/node-version-1.1.0.tgz",
"integrity": "sha512-t1V2RFiaTavaW3jtQO0A2nok6k7/Gghuvx2rjvICuT0B0dYaObBQ4U0xHL+ZTPFZodt1LMYG2Vi2nypfz4/AJg=="
},
"nopt": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
@ -6349,6 +6375,11 @@
"resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM="
},
"promise-polyfill": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.1.0.tgz",
"integrity": "sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc="
},
"proxy-addr": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz",

View File

@ -15,12 +15,14 @@
"cy:open": "cypress open",
"test": "run-p --race dev cy:run",
"globalize-css": "node ./bin/globalize-css.js",
"deglobalize-css": "node ./bin/globalize-css.js --reverse"
"deglobalize-css": "node ./bin/globalize-css.js --reverse",
"setup-mastodon": "node ./bin/setup-mastodon.js"
},
"dependencies": {
"@gamestdio/websocket": "^0.2.2",
"a11y-dialog": "^4.0.1",
"cheerio": "^1.0.0-rc.2",
"child-process-promise": "^2.2.1",
"chokidar": "^2.0.0",
"compression": "^1.7.1",
"concurrently": "^3.5.1",
@ -44,7 +46,6 @@
"pify": "^3.0.0",
"quick-lru": "^1.1.0",
"requestidlecallback": "^0.3.0",
"rimraf": "^2.6.2",
"sapper": "nolanlawson/sapper#fix-style-loader-built",
"serve-static": "^1.13.1",
"standard": "^10.0.3",