Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Added default port ssh port 22 and forwarding of config port setting #6428

Merged
merged 5 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/docs/deploy/baremetal.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ This lists a single server, in the `production` environment, providing the hostn
#### Config Options

* `host` - hostname to the server
* `port` - [optional] ssh port for server connection, defaults to 22
* `username` - the user to login as
* `password` - [optional] if you are using password authentication, include that here
* `privateKey` - [optional] if you connect with a private key, include the content of the key here, as a buffer: `privateKey: Buffer.from('...')`. Use this *or* `privateKeyPath`, not both.
Expand Down Expand Up @@ -267,7 +268,7 @@ sudo mkdir -p /var/www/myapp
sudo chown deploy:deploy /var/www/myapp
```

You'll want to create an `.env` file in this directory containing any environment variables that are needed by your by your app (like `DATABASE_URL` at a minimum). This will be symlinked to each release directory so that it's available as the app expects (in the root directory of the codebase).
You'll want to create an `.env` file in this directory containing any environment variables that are needed by your app (like `DATABASE_URL` at a minimum). This will be symlinked to each release directory so that it's available as the app expects (in the root directory of the codebase).

:::caution SSH and Non-interactive Sessions

Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/commands/deploy/__tests__/baremetal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ describe('serverConfigWithDefaults', () => {

it('overrides defaults with custom', () => {
const serverConfig = {
port: 12345,
cannikin marked this conversation as resolved.
Show resolved Hide resolved
branch: 'venus',
packageManagerCommand: 'npm',
monitorCommand: 'god',
Expand All @@ -141,6 +142,11 @@ describe('serverConfigWithDefaults', () => {
expect(config).toEqual(serverConfig)
})

it('provides default port as 22', () => {
const config = baremetal.serverConfigWithDefaults({}, {})
expect(config.port).toEqual(22)
})

it('provides default branch name', () => {
const config = baremetal.serverConfigWithDefaults({}, {})
expect(config.branch).toEqual('main')
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/commands/deploy/baremetal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const SYMLINK_FLAGS = '-nsf'
const CURRENT_RELEASE_SYMLINK_NAME = 'current'
const LIFECYCLE_HOOKS = ['before', 'after']
export const DEFAULT_SERVER_CONFIG = {
port: 22,
branch: 'main',
packageManagerCommand: 'yarn',
monitorCommand: 'pm2',
Expand Down Expand Up @@ -634,6 +635,7 @@ export const commands = (yargs, ssh) => {
task: () =>
ssh.connect({
host: serverConfig.host,
port: serverConfig.port,
username: serverConfig.username,
password: serverConfig.password,
privateKey: serverConfig.privateKey,
Expand Down