Error Deploying Meteor App on DigitalOcean Using Meteor Up - meteor

I was trying to deploy a Meteor app onto a DigitalOcean droplet, via its IP address (I have no domain name). I am doing this kind of thing for the first time, so was having a lot of issues with it.
This is my droplet on Digital Ocean:
I created a MUP (Meteor Up) directory outside my Meteor app’s repo using mup init, and this is the mup.js file that I have:
module.exports = {
servers: {
one: {
host: '162.243.57.207',
username: 'cs673f16',
pem: '/Users/gautambhat/.ssh/id_rsa'
// password:
// or leave blank for authenticate from ssh-agent
}
},
meteor: {
name: 'meetcute',
path: '/Users/gautambhat/Repos/CS673_team2',
servers: {
one: {}
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: 'http://162.243.57.207',
PORT : 3000
//MONGO_URL: 'mongodb://localhost/meteor'
},
//dockerImage: 'kadirahq/meteord'
deployCheckWaitTime: 60
},
mongo: {
oplog: true,
port: 27017,
servers: {
one: {},
},
},
};
Also, I don't know my MONGO_URL, or where to find it, so I just commented it out. After running setup, and the running mup deploy, I get this:
=> Starting meteor app on port:80
assert.js:93
throw new assert.AssertionError({
^
AssertionError: "undefined" === "function"
at wrapPathFunction (/bundle/bundle/programs/server/mini-files.js:77:10)
at Object.<anonymous> (/bundle/bundle/programs/server/mini-files.js:108:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/bundle/bundle/programs/server/boot.js:9:13)
at Module._compile (module.js:456:26)
-----------------------------------STDOUT-----------------------------------

After researching a bit online on different sites, I found a fix here
The new kadirahq/mup
The default dockerImage is meteorhacks/meteord:base and thus still uses Node 0.10.43. If someone builds and publishes a new image from the base, it could be easily swapped in. I've gone ahead and provided an abernix/meteord:base image with the necessary changes to run Node 4.4.7 + the benefit of NPM 3 on an updated distro (jessie instead of wheezy). I'm not sure if this is something that kadira will provide soon themselves or not.
You can use my image by adding the following in your mup.js, inside the meteor object (see docs for details), and re-deploying with mup deploy:
dockerImage: 'abernix/meteord:base'

Related

Issue with react-refresh-webpack-plugin and wordpress/scripts using --hot

I am not able to get the HMR with "wp-scripts start --hot" running. I tried this in several project, including rather empty projects.
As soon as I add the --hot flag to my npm script, I can still get the script running but I get this error message in my console:
ReactRefreshEntry.js:17 Uncaught TypeError: Cannot read properties of undefined (reading 'injectIntoGlobalHook')
at ./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js (ReactRefreshEntry.js:17:1)
at options.factory (react refresh:6:1)
at __webpack_require__ (bootstrap:24:1)
at startup:4:66
at __webpack_require__.O (chunk loaded:25:1)
at startup:9:1
at startup:9:1
It doesn't even load my Javascript as it seems to break at an earlier point.
I already changed Node Versions back and forth, deleted all node-modules and the package-lock.json, took out all my Javascript to see if this solves anything, but it doesn't.
My setup:
Local by Flyhweel as Wordpress local environment
Wordpress: 6.0.3
Node V 16.18.0
npm 8.19.2
#wordpress/scripts Version: 24.4.0
wp-config.php:
define('WP_DEBUG', false); define('SCRIPT_DEBUG', true);
Also I got the Gutenberg Plugin installed and activated as stated here: https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/#:~:text=%2D%2Dhot%20%E2%80%93%20enables%20%E2%80%9CFast%20Refresh%E2%80%9D.%20The%20page%20will%20automatically%20reload%20if%20you%20make%20changes%20to%20the%20code.%20For%20now%2C%20it%20requires%20that%20WordPress%20has%20the%20SCRIPT_DEBUG%20flag%20enabled%20and%20the%20Gutenberg%20plugin%20installed.
Does anyone else experience this bug or can anyone help with this?
Many thanks and cheers
Johannes
Alternative
I could not get react-refresh-webpack-plugin to work in #worpress/script so ended up using BrowserSyncPlugin, here is how i extended the #wordpress/script webpack config. Hope it helps someone
/**
* External Dependencies
*/
const path = require('path');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
/**
* WordPress Dependencies
*/
const defaultConfig = require('#wordpress/scripts/config/webpack.config.js');
module.exports = {
...defaultConfig,
...{
entry: {
theme: path.resolve(process.cwd(), 'src', 'theme.js'),
},
plugins: [
...defaultConfig.plugins,
new BrowserSyncPlugin({
// inspect docker network to get this container external ip
// then specify it in host
host: '172.44.0.3', //docker container host
port: 8887,
//server: { baseDir: ['public'] },
proxy: 'http://172.44.0.1:7020/', //docker container host
open: false
}),
]
}
}
and yarn run start
Disclaimer: Am developing in docker env. i know its not answer to the question, but if you are stuck, kindly try it out.

Unexpected EPLUGINCONF at plugin loading phase

I'm implementing a semantic-release plugin but when I applied it to build, it triggers following error.
I can understand that generated configuration for my plugin (gradle-semantic-release-plugin) is bad, but I cannot find why it happened and how I can fix. I wish I can get help from community.
✖ EPLUGINCONF The `prepare` plugin configuration is invalid.
The prepare plugin configuration (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/plugins.md#prepare-plugin) must be
a single or an array of plugins definition. A plugin definition is an npm module name, optionnaly wrapped in an array with an object.
Your configuration for the prepare plugin is [ [ { [AsyncFunction: prepare] pluginName: '#semantic-release/changelog' }, {} ], [ { updateVersion:
[AsyncFunction: updateVersion], default: [AsyncFunction: prepare], pluginName: 'gradle-semantic-release-plugin' }, {} ], [ { [AsyncFunction: prepa
re] pluginName: '#semantic-release/git' }, { assets: [Array] } ] ].
{ AggregateError:
SemanticReleaseError: The `prepare` plugin configuration is invalid.
at module.exports (/home/kengo/GitHub/gradle-boilerplate/node_modules/semantic-release/lib/get-error.js:6:10)
at Object.entries.reduce (/home/kengo/GitHub/gradle-boilerplate/node_modules/semantic-release/lib/plugins/index.js:61:23)
at Array.reduce (<anonymous>)
at module.exports (/home/kengo/GitHub/gradle-boilerplate/node_modules/semantic-release/lib/plugins/index.js:47:59)
at module.exports (/home/kengo/GitHub/gradle-boilerplate/node_modules/semantic-release/lib/get-config.js:83:35)
at <anonymous>
at module.exports (/home/kengo/GitHub/gradle-boilerplate/node_modules/semantic-release/lib/plugins/index.js:87:11)
at module.exports (/home/kengo/GitHub/gradle-boilerplate/node_modules/semantic-release/lib/get-config.js:83:35)
at <anonymous>
My configuration for release is listed in this package.json and there is no configuration for my plugin.
Thanks in advance!
I found that it is because I exported multiple functions as prepare. This PR solved my problem.

mup deploy - Nothing Happens

I'm trying to deploy a meteor app to Digital Ocean. I followed the steps here, https://www.npmjs.com/package/mup and when I run 'mup deploy' from the .deploy directory nothing happens. I included my mup.js file below.
After researching this issue a common solution was to use an absolute path for the pem field but I did that and I also tried a password instead and still nothing happens. Also, if I run 'mup setup', 'mup log', 'mup start', 'mup reconfig', etc. nothing happens. Any ideas?
.deploy/mup.js
module.exports = {
servers: {
one: {
host: '100.000.00.00',
username: 'root',
//password: 'password123' <-- also tried password
pem: 'C:/Users/User/.ssh/id_rsa'
}
},
meteor: {
name: 'AppName',
path: '..',
servers: {
one: {}
},
buildOptions: {
debug: true,
},
env: {
ROOT_URL: 'http://100.000.00.00',
MONGO_URL: 'mongodb://localhost/meteor'
},
deployCheckWaitTime: 60
},
mongo: {
oplog: true,
port: 27017,
servers: {
one: {},
},
},
};
So I finally found this same question answered in a couple of places but just in case someone stumbles across this first here is the solution.
Go to the the root directory of the project then run (assuming mup was initialized in the .deploy directory):
mup setup --config .deploy/mup.js
mup deploy --config .deploy/mup.js
I'm not sure why this isn't in the documentation.

Getting a mup setup error (AWS EC2 instance)

I am trying to setup a simple Telescope Meteor app on an AWS EC2 instance and I am getting an error message when trying to run mup setup:
Here is my mup.json file:
{
// Server authentication info
"servers": [
{
"host": "ec2-54-191-197-203.us-west-2.compute.amazonaws.com",
"username": "ubuntu",
//"password": "password"
// or pem file (ssh based authentication)
//"pem": "/Users/apple/Coding/Contract Work/TelescopeApp.pem"
}
],
// Install MongoDB in the server, does not destroy local MongoDB on future setup
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
"nodeVersion": "0.10.36",
// Install PhantomJS in the server
"setupPhantom": true,
// Show a progress bar during the upload of the bundle to the server.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": true,
// Application name (No spaces)
"appName": "TelescopeApp",
// Location of app (local directory)
"app": "/Users/apple/Coding/Contract Work",
// Configure environment
"env": {
"PORT": 80,
"ROOT_URL": "http://ec2-54-191-197-203.us-west-2.compute.amazonaws.com",
"MONGO_URL" "mongodb://localhost:27017/Telescope-database"
},
// Meteor Up checks if the app comes online just after the deployment
// before mup checks that, it will wait for no. of seconds configured below
"deployCheckWaitTime": 15
}
Here is the error message:
Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
/usr/local/lib/node_modules/mup/node_modules/cjson/index.js:226
throw err;
^
SyntaxError: Trailing comma in object at 10:5
}
^
File: "/Users/apple/Coding/Contract Work/Telescope/mup.json"
at SyntaxError (native)
at Object.parseJSON (/usr/local/lib/node_modules/mup/node_modules/jju/lib/parse.js:745:13)
at Object.parse (/usr/local/lib/node_modules/mup/node_modules/json-parse-helpfulerror/index.js:10:13)
at Object.exports.parse (/usr/local/lib/node_modules/mup/node_modules/cjson/index.js:90:28)
at Object.load (/usr/local/lib/node_modules/mup/node_modules/cjson/index.js:223:24)
at Object.exports.read (/usr/local/lib/node_modules/mup/lib/config.js:12:25)
at Object.<anonymous> (/usr/local/lib/node_modules/mup/bin/mup:20:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
What am I doing wrong?
change
"username": "ubuntu",
to
"username": "ubuntu"
You probably commented the "password: "password" line and forgot to remove the additional comma after "username": "ubuntu",.

grunt-contrib-connect | root path must be a string Use

While running Grunt task, getting following error.
Running "connect:client" (connect) task
Warning: root path must be a string Use --force to continue.
TypeError: root path must be a string
at Function.serveStatic (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt-contrib-connect/node_modules/connect/node_modules/serve-static/index.js:43:11)
at Object.livereloadMiddleware (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/GruntFile.js:25:23)
at Object.<anonymous> (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt-contrib-connect/tasks/connect.js:110:41)
at Object.<anonymous> (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt/lib/grunt/task.js:264:15)
at Object.thisTask.fn (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt/lib/grunt/task.js:82:16)
at Object.<anonymous> (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt/lib/util/task.js:301:30)
at Task.runTaskFn (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt/lib/util/task.js:251:24)
at Task.<anonymous> (/Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt/lib/util/task.js:300:12)
at /Users/marif/Dev/JavaScript/JavaScript-Boilerplate/node_modules/grunt/lib/util/task.js:227:11
at process._tickCallback (node.js:355:11)
Grunt task is as given below:
connect: {
client: {
options: {
// The server's port, and the folder to serve from:
// Ex: 'localhost:9000' would serve up 'client/index.html'
port: 9000,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost',
base: '<%= jsb.app %>',
// Custom middleware for the HTTP server:
// The injected JavaScript reloads the page.
middleware: livereloadMiddleware
}
}
}
Have tried to uninstall and install the npm package but no luck so far.
Can someone please point, what exactly I am missing here?
It seems like my options.base in my middleware function was becoming an array because I have updated the npm package grunt-contrib-connect to latest which is 0.10.1.
Have to change the snippet rather:
connect.static(options.base),
// Make empty directories browsable.
connect.directory(options.base)
It must be an Array and it should start working:
connect.static(options.base[0]),
// Make empty directories browsable.
connect.directory(options.base[0])
Hope it also helps someone!

Resources