Skip to content

Commit

Permalink
Added Linux VM instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
saiprasanth1303 committed Jan 17, 2023
1 parent 4c42691 commit 75abcb3
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import cx from 'classnames';
import { HiViewGridAdd } from 'react-icons/hi';
import { Button, Card, Step, Stepper, Typography } from 'ui-components';

import { CopyToClipboardIcon } from '../../../../../components/CopyToClipboardIcon';
import { usePageNavigation } from '../../../../../utils/usePageNavigation';

export const LinuxConnectorForm = () => {
const { navigate } = usePageNavigation();

const code = `docker run -dit --cpus=".2" --name=deepfence-agent --restart on-failure --pid=host --net=host \\
--privileged=true -v /sys/kernel/debug:/sys/kernel/debug:rw -v /var/log/fenced \\
-v /var/run/docker.sock:/var/run/docker.sock -v /:/fenced/mnt/host/:ro \\
-e USER_DEFINED_TAGS="" -e MGMT_CONSOLE_URL="${
window.location.host ?? '---CONSOLE-IP---'
}" -e MGMT_CONSOLE_PORT="443" \\
-e DEEPFENCE_KEY="${localStorage.getItem('dfApiKey') ?? '---DEEPFENCE-API-KEY---'}" \\
deepfenceio/deepfence_agent_ce:latest`;

return (
<Stepper>
<Step indicator={<HiViewGridAdd />} title="Connect Linux VM">
<div className={`${Typography.size.sm} dark:text-gray-200`}>
Connect to Linux VM. Find out more information by{' '}
<a
href={`https://docs.deepfence.io/docs/threatmapper/sensors/linux-host/`}
target="_blank"
rel="noreferrer"
className="text-blue-600 dark:text-blue-500 mt-2"
>
reading our documentation
</a>
.
</div>
</Step>
<Step indicator="1" title="Deploy">
<div className={`${Typography.size.sm} dark:text-gray-400`}>
<p className="mb-2.5">
Copy the following commands and paste them into your shell.
</p>
<Card className="w-full relative ">
<pre
className={cx(
'pl-4 pt-4',
'h-fit',
`${Typography.weight.normal} ${Typography.size.xs} `,
)}
>
{code}
</pre>
<CopyToClipboardIcon text={code} />
</Card>
<div className="flex flex-col mt-6">
<p className={`${Typography.size.xs}`}>
Note: After successfully run the commands above, your connector will appear
on MyConnector page, then you can perform scanning.
</p>
<Button
size="xs"
color="primary"
className="ml-auto"
onClick={() => {
navigate('/onboard/my-connectors');
}}
>
Go to connectors
</Button>
</div>
</div>
</Step>
</Stepper>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Button } from 'ui-components';

import { usePageNavigation } from '../../../utils/usePageNavigation';
import { ConnectorHeader } from '../components/ConnectorHeader';
import { LinuxConnectorForm } from '../components/connectors/hosts/LinuxConnectorForm';

export const LinuxConnector = () => {
const { goBack } = usePageNavigation();

return (
<div className="w-full">
<ConnectorHeader
title="Connect a Linux VM"
description="Deploy all modules for Deepfence Compliance Scanner at Linux VM."
/>
<LinuxConnectorForm />

<Button onClick={goBack} size="xs" className="mt-16" color="default">
Cancel
</Button>
</div>
);
};
5 changes: 5 additions & 0 deletions deepfence_frontend/apps/dashboard/src/routes/private.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Connector } from '../features/onboard/pages/Connector';
import { DockerConnector } from '../features/onboard/pages/DockerConnector';
import { GCPConnector } from '../features/onboard/pages/GCPConnector';
import { K8sConnector } from '../features/onboard/pages/K8sConnector';
import { LinuxConnector } from '../features/onboard/pages/LinuxConnector';

export const privateRoutes: RouteObject[] = [
{
Expand Down Expand Up @@ -46,6 +47,10 @@ export const privateRoutes: RouteObject[] = [
path: 'docker',
element: <DockerConnector />,
},
{
path: 'host-linux',
element: <LinuxConnector />,
},
{
path: 'registry/amazon-ecr',
element: <AmazonECRConnector />,
Expand Down

0 comments on commit 75abcb3

Please sign in to comment.