test: always migrate mastodon server when launching (#1941)

This fixes some bugs in dev mode where the Mastodon DB might say it needs a Rails migration stil.
This commit is contained in:
Nolan Lawson 2021-02-15 12:54:08 -08:00 committed by GitHub
parent 2585b55479
commit 09b5474e22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,12 +58,11 @@ async function runMastodon () {
DB_PORT DB_PORT
}) })
const cwd = mastodonDir const cwd = mastodonDir
const cmds = [ const installCommands = [
'gem update --system', 'gem update --system',
'gem install bundler foreman', 'gem install bundler foreman',
'bundle config set --local frozen \'true\'', 'bundle config set --local frozen \'true\'',
'bundle install', 'bundle install',
'bundle exec rails db:migrate',
'yarn --pure-lockfile' 'yarn --pure-lockfile'
] ]
@ -73,12 +72,13 @@ async function runMastodon () {
console.log('Already installed Mastodon') console.log('Already installed Mastodon')
} catch (e) { } catch (e) {
console.log('Installing Mastodon...') console.log('Installing Mastodon...')
for (const cmd of cmds) { for (const cmd of installCommands) {
console.log(cmd) console.log(cmd)
await exec(cmd, { cwd, env }) await exec(cmd, { cwd, env })
} }
await writeFile(installedFile, '', 'utf8') await writeFile(installedFile, '', 'utf8')
} }
await exec('bundle exec rails db:migrate', { cwd, env })
const promise = spawn('foreman', ['start'], { cwd, env }) const promise = spawn('foreman', ['start'], { cwd, env })
// don't bother writing to mastodon.log in CI; we can't read the file anyway // don't bother writing to mastodon.log in CI; we can't read the file anyway
const logFile = process.env.CIRCLECI ? '/dev/null' : 'mastodon.log' const logFile = process.env.CIRCLECI ? '/dev/null' : 'mastodon.log'