update to mastodon 2.4.0 in travis (#371)
* update to mastodon 2.4.0 in travis * lint fix
This commit is contained in:
parent
708340502d
commit
992c3a890d
|
@ -88,4 +88,17 @@ The Webpack Bundle Analyzer `report.html` and `stats.json` are available publicl
|
|||
- [dev.pinafore.social/report.html](https://dev.pinafore.social/report.html)
|
||||
- [dev.pinafore.social/stats.json](https://dev.pinafore.social/stats.json)
|
||||
|
||||
This is also available locally after `npm run build` at `.sapper/client/report.html`.
|
||||
This is also available locally after `npm run build` at `.sapper/client/report.html`.
|
||||
|
||||
## Updating Mastodon used for testing
|
||||
|
||||
1. Run `rm -fr mastodon` to clear out all Mastodon data
|
||||
1. Comment out `await restoreMastodonData()` in `run-mastodon.js` to avoid actually populating the database with statuses/favorites/etc.
|
||||
2. Update the `GIT_TAG` in `run-mastodon.js` to whatever you want
|
||||
3. Run `npm run run-mastodon`
|
||||
4. Run `npm run backup-mastodon-data` to overwrite the data in `fixtures/`
|
||||
5. Uncomment `await restoreMastodonData()` in `run-mastodon.js`
|
||||
6. Commit all changed files
|
||||
7. Run `rm -fr mastodon/` and `npm run run-mastodon` to confirm everything's working
|
||||
|
||||
Check `mastodon.log` if you have any issues.
|
|
@ -13,19 +13,21 @@ const stat = pify(fs.stat.bind(fs))
|
|||
const writeFile = pify(fs.writeFile.bind(fs))
|
||||
const dir = __dirname
|
||||
|
||||
const GIT_URL = 'https://github.com/nolanlawson/mastodon'
|
||||
const GIT_BRANCH = 'for-pinafore'
|
||||
const GIT_URL = 'https://github.com/tootsuite/mastodon.git'
|
||||
const GIT_TAG = 'v2.4.0'
|
||||
|
||||
const DB_NAME = 'pinafore_development'
|
||||
const DB_USER = 'pinafore'
|
||||
const DB_PASS = 'pinafore'
|
||||
const DB_PORT = process.env.PGPORT || 5432
|
||||
const DB_HOST = '127.0.0.1'
|
||||
|
||||
const envFile = `
|
||||
PAPERCLIP_SECRET=foo
|
||||
SECRET_KEY_BASE=bar
|
||||
OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=${process.env.PGPORT || 5432}
|
||||
DB_HOST=${DB_HOST}
|
||||
DB_PORT=${DB_PORT}
|
||||
DB_USER=${DB_USER}
|
||||
DB_NAME=${DB_NAME}
|
||||
DB_PASS=${DB_PASS}
|
||||
|
@ -40,7 +42,8 @@ async function cloneMastodon () {
|
|||
await stat(mastodonDir)
|
||||
} catch (e) {
|
||||
console.log('Cloning mastodon...')
|
||||
await exec(`git clone ${GIT_URL} --branch ${GIT_BRANCH} --single-branch --depth 1 "${mastodonDir}"`)
|
||||
await exec(`git clone ${GIT_URL} "${mastodonDir}"`)
|
||||
await exec(`git checkout ${GIT_TAG}`, { cwd: mastodonDir })
|
||||
await writeFile(path.join(dir, '../mastodon/.env'), envFile, 'utf8')
|
||||
}
|
||||
}
|
||||
|
@ -75,20 +78,28 @@ async function setupMastodonDatabase () {
|
|||
|
||||
async function runMastodon () {
|
||||
console.log('Running mastodon...')
|
||||
let env = Object.assign({}, process.env, {
|
||||
RAILS_ENV: 'development',
|
||||
NODE_ENV: 'development',
|
||||
DB_NAME,
|
||||
DB_USER,
|
||||
DB_PASS,
|
||||
DB_HOST,
|
||||
DB_PORT
|
||||
})
|
||||
let cwd = mastodonDir
|
||||
let cmds = [
|
||||
'gem install bundler foreman',
|
||||
'bundle install',
|
||||
'bundle exec rails db:migrate',
|
||||
'yarn --pure-lockfile'
|
||||
]
|
||||
|
||||
for (let cmd of cmds) {
|
||||
console.log(cmd)
|
||||
await exec(cmd, {cwd: mastodonDir})
|
||||
await exec(cmd, {cwd, env})
|
||||
}
|
||||
const promise = spawn('foreman', ['start'], {
|
||||
cwd: mastodonDir,
|
||||
env: Object.assign({}, process.env, {RAILS_ENV: 'development', NODE_ENV: 'development'})
|
||||
})
|
||||
const promise = spawn('foreman', ['start'], {cwd, env})
|
||||
const log = fs.createWriteStream('mastodon.log', {flags: 'a'})
|
||||
childProc = promise.childProcess
|
||||
childProc.stdout.pipe(log)
|
||||
|
|
|
@ -8,8 +8,8 @@ if [[ "$COMMAND" = deploy-dev-travis ]]; then
|
|||
fi
|
||||
|
||||
source "$HOME/.rvm/scripts/rvm"
|
||||
rvm install 2.5.0
|
||||
rvm use 2.5.0
|
||||
rvm install 2.5.1
|
||||
rvm use 2.5.1
|
||||
|
||||
sudo -E add-apt-repository -y ppa:mc3man/trusty-media
|
||||
sudo -E apt-get update
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
"deploy-prod": "run-s stage-prod launch alias-prod cleanup",
|
||||
"deploy-dev": "run-s stage-dev launch alias-dev cleanup",
|
||||
"deploy-dev-travis": "if [ $TRAVIS_BRANCH = master -a $TRAVIS_PULL_REQUEST = false ]; then run-s stage-dev launch-travis alias-dev-travis cleanup-travis; fi",
|
||||
"backup-mastodon-data": "pg_dump -Fc mastodon_development > fixtures/dump.sql && cd mastodon/public/system && tar -czf ../../../fixtures/system.tgz ."
|
||||
"backup-mastodon-data": "PGPASSWORD=pinafore pg_dump -U pinafore -w mastodon_development > fixtures/dump.sql && cd mastodon/public/system && tar -czf ../../../fixtures/system.tgz ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@gamestdio/websocket": "^0.2.5",
|
||||
|
|
Loading…
Reference in New Issue