Open vystepanenko opened 6 years ago
I am having exactly the same issue. Only the last host is being uploaded to.
I am having this issue too. I think it is a matter of the 'context' being exactly the same between two hosts. I have a test machine and a prod machine. The remote paths are different on those, but the context is the same: c:\Projects\name
If I change the context on one of them to be a different folder, for example a sub folder, then both show up: c:\Projects\name c:\Projects\name\subfolder
Same issue. Is it possible to upload on many hosts with same context/VS Code folder ?
This config working for me
"targets": [
{
"type": "sftp",
"name": "Test",
"description": "Test server",
"dir": "/path",
"host": "test_host_ip",
"port": 22,
"user": "username",
"password": "password",
"mappings": {
"/public": "/public"
}
},
{
"type": "sftp",
"name": "Prod",
"description": "Prod server",
"dir": "/path",
"host": "prod_host_ip",
"port": 22,
"user": "username",
"password": "password",
}
]
What is is your config?
With sftp V1.1.3, I got "targets":
Incorrect type. Expected "array".
This is target section of config.
Whole config looks like
{
"deploy.reloaded": {
"targets": [
{
....target 1....
},
{
.....target2 ....
}
]
}
}
I don't understand, sftp.json
config file only accepts array like this example
[
{
"protocol": "sftp",
"host": "test_host",
"port": 22
},
{
"protocol": "sftp",
"host": "prod_host",
"port": 22
}
]
Do you use vscode-deploy-reloaded extension, like this target_sftp ?
sorry man, I mixed up extension
Yes I'm using vscode-deploy-reloaded
@liximomo Any status on getting this added? It'd make my life a lot easier.
Also, does the extension actually currently have the ability to do more than one? If so, how would I do it?
I think there are some problem in "context" setting, I have a trick like:
[
{
"context": ".",
"protocol": "sftp",
"host": "test_host",
"port": 22
},
{
"context": "../YOUR_SRC_FILE_FOLDER",
"protocol": "sftp",
"host": "prod_host",
"port": 22
}
]
+1
I was looking for something useful to watch and deploy the same files to many clients at once. doing this manually was tedious so here it goes:
for the ones who also still struggle on doing this I would strongly recommend something using the watch tool + ftp solution (vinyl,sftp.... whatever it is) as following
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const gutil = require('gulp-util');
var ftp = require( 'vinyl-ftp' );
const sourcemaps = require('gulp-sourcemaps');
const errorHandler = require('gulp-error-handle');
const logError = function(err) {
gutil.log(err);
this.emit('end');
};
const minify = require('gulp-minify');
const { watch } = require('gulp');
function w() {
const project_globs = ['public/dist/**', 'resources/**', 'app/**', 'config/**', 'routes/**', 'database/**'];
watch(project_globs, function(cb) {
var conn = ftp.create( {
host: 'wwwfileshost',
user: 'myselfthegrandpa',
password: 'hardpass',
parallel: 10,
log: gutil.log
} );
var globs = project_globs;
// using base = '.' will transfer everything to /public_html correctly
// turn off buffering in gulp.src for best performance
//first client
gulp.src( globs, { base: '.', buffer: false } )
.pipe( conn.newer( '/public_html/domains/myfirstclient/' ) ) // only upload newer files
.pipe( conn.dest( '/public_html/domains/myfirstclient/' ) );
//second client
gulp.src( globs, { base: '.', buffer: false } )
.pipe( conn.newer( '/public_html/domains/mysecondclient/' ) ) // only upload newer files
.pipe( conn.dest( '/public_html/domains/mysecondclient/' ) );
//and so on
cb();
});
}
exports.w = w;
This is a useful feature. feature request for more than 1 year. encounter any difficulty to implemented?
+1
You guy just have to start ftp.create({options}) with custom options for each host. It works.
+1
+1
+1
+1怎么还不解决
I think there are some problem in "context" setting, I have a trick like:
[ { "context": ".", "protocol": "sftp", "host": "test_host", "port": 22 }, { "context": "../YOUR_SRC_FILE_FOLDER", "protocol": "sftp", "host": "prod_host", "port": 22 } ]
I make a symbolic link of my souce file folder and add to the context, which seems to work.
[
{
"context": ".",
"protocol": "sftp",
"host": "test_host",
"port": 22
},
{
"context": "../YOUR_SRC_FILE_FOLDER_SYMBOLIC_LINK",
"protocol": "sftp",
"host": "prod_host",
"port": 22
}
]
Expected Behavior
I want to send file from one workspace to several hosts. Is there any way to do this?
I tried to do something like
But on upload it send file only to prod_host.
It would be great to have posibility configure several hosts and on upload vscode will ask you on what host you want to upload the file