Skip to content

Commit

Permalink
Merge pull request #25 from Dokploy/canary
Browse files Browse the repository at this point in the history
Main release
  • Loading branch information
Siumauricio authored May 2, 2024
2 parents 307ae22 + 3f9e138 commit de278d9
Show file tree
Hide file tree
Showing 53 changed files with 575 additions and 298 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.git
.gitignore
*.md
dist
3 changes: 3 additions & 0 deletions .env.production.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DATABASE_URL="postgres://dokploy:amukds4wi9001583845717ad2@dokploy-postgres:5432/dokploy"
PORT=3000
NODE_ENV=production
60 changes: 58 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ on:
pull_request:
branches:
- main
- canary

push:
branches:
- main
- canary
jobs:
build:
build-app:
if: github.event_name == 'pull_request'
runs-on: ubuntu-20.04
strategy:
matrix:
Expand All @@ -22,4 +29,53 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Run Build
run: pnpm build
run: pnpm build


build-docker-on-pr:
if: github.event_name == 'pull_request'
needs: build-app
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Prepare .env file
run: |
cp .env.production.example .env.production
- name: Run custom Docker build script
run: |
chmod +x ./docker/build.sh
echo "Building Docker image for ${{ github.base_ref }}"
./docker/build.sh ${{ github.base_ref == 'canary' && 'canary' || '' }}
build-and-push-docker-on-push:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Prepare .env file
run: |
cp .env.production.example .env.production
- name: Build and push Docker image using custom script
run: |
chmod +x ./docker/build.sh
chmod +x ./docker/push.sh
./docker/build.sh ${{ github.ref_name == 'canary' && 'canary' || '' }}
./docker/push.sh ${{ github.ref_name == 'canary' && 'canary' || '' }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.pnp.js
/redis-data
traefik.yml
.docker
.env.production

# testing
/coverage
Expand Down
26 changes: 21 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,41 +49,57 @@ feat: add new feature
```




## Setup

Before you start, please make the clone based on the `canary` branch, since the `main` branch is the source of truth and should always reflect the latest stable release, also the PRs will be merged to the `canary` branch.

```bash
git clone https://github.com/dokploy/dokploy.git
cd dokploy
npm install
pnpm install
cp .env.example .env
```

## Development

Is required to have **Docker** installed on your machine.


### Setup

Run the command that will spin up all the required services and files.

```bash
npm run dev
pnpm run setup
```

Now run the development server.

```bash
pnpm run dev
```


Go to http://localhost:3000 to see the development server

## Build

```bash
npm run build
pnpm run build
```

## Docker

To build the docker image
```bash
npm run docker:build
pnpm run docker:build
```

To push the docker image
```bash
npm run docker:push
pnpm run docker:push
```

## Password Reset
Expand Down
2 changes: 1 addition & 1 deletion components/auth/login-2fa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Login2FA = ({ authId }: Props) => {
duration: 2000,
});

push("/dashboard");
push("/dashboard/projects");
})
.catch(() => {
toast.error("Signin failed", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ import { api } from "@/utils/api";
import { toast } from "sonner";
import { Textarea } from "@/components/ui/textarea";

const addEnviromentSchema = z.object({
enviroment: z.string(),
const addEnvironmentSchema = z.object({
environment: z.string(),
});

type EnviromentSchema = z.infer<typeof addEnviromentSchema>;
type EnvironmentSchema = z.infer<typeof addEnvironmentSchema>;

interface Props {
applicationId: string;
}

export const ShowEnviroment = ({ applicationId }: Props) => {
export const ShowEnvironment = ({ applicationId }: Props) => {
const { mutateAsync, isLoading } =
api.application.saveEnviroment.useMutation();
api.application.saveEnvironment.useMutation();

const { data, refetch } = api.application.one.useQuery(
{
Expand All @@ -43,42 +43,42 @@ export const ShowEnviroment = ({ applicationId }: Props) => {
enabled: !!applicationId,
},
);
const form = useForm<EnviromentSchema>({
const form = useForm<EnvironmentSchema>({
defaultValues: {
enviroment: "",
environment: "",
},
resolver: zodResolver(addEnviromentSchema),
resolver: zodResolver(addEnvironmentSchema),
});

useEffect(() => {
if (data) {
form.reset({
enviroment: data.env || "",
environment: data.env || "",
});
}
}, [form.reset, data, form]);

const onSubmit = async (data: EnviromentSchema) => {
const onSubmit = async (data: EnvironmentSchema) => {
mutateAsync({
env: data.enviroment,
env: data.environment,
applicationId,
})
.then(async () => {
toast.success("Enviroments Added");
toast.success("Environments Added");
await refetch();
})
.catch(() => {
toast.error("Error to add enviroment");
toast.error("Error to add environment");
});
};

return (
<div className="flex w-full flex-col gap-5 ">
<Card className="bg-background">
<CardHeader>
<CardTitle className="text-xl">Enviroment Settings</CardTitle>
<CardTitle className="text-xl">Environment Settings</CardTitle>
<CardDescription>
You can add enviroment variables to your resource.
You can add environment variables to your resource.
</CardDescription>
</CardHeader>
<CardContent>
Expand All @@ -90,7 +90,7 @@ export const ShowEnviroment = ({ applicationId }: Props) => {
>
<FormField
control={form.control}
name="enviroment"
name="environment"
render={({ field }) => (
<FormItem className="w-full">
<FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ import { api } from "@/utils/api";
import { toast } from "sonner";
import { Textarea } from "@/components/ui/textarea";

const addEnviromentSchema = z.object({
enviroment: z.string(),
const addEnvironmentSchema = z.object({
environment: z.string(),
});

type EnviromentSchema = z.infer<typeof addEnviromentSchema>;
type EnvironmentSchema = z.infer<typeof addEnvironmentSchema>;

interface Props {
mariadbId: string;
}

export const ShowMariadbEnviroment = ({ mariadbId }: Props) => {
const { mutateAsync, isLoading } = api.mariadb.saveEnviroment.useMutation();
export const ShowMariadbEnvironment = ({ mariadbId }: Props) => {
const { mutateAsync, isLoading } = api.mariadb.saveEnvironment.useMutation();

const { data, refetch } = api.mariadb.one.useQuery(
{
Expand All @@ -42,42 +42,42 @@ export const ShowMariadbEnviroment = ({ mariadbId }: Props) => {
enabled: !!mariadbId,
},
);
const form = useForm<EnviromentSchema>({
const form = useForm<EnvironmentSchema>({
defaultValues: {
enviroment: "",
environment: "",
},
resolver: zodResolver(addEnviromentSchema),
resolver: zodResolver(addEnvironmentSchema),
});

useEffect(() => {
if (data) {
form.reset({
enviroment: data.env || "",
environment: data.env || "",
});
}
}, [form.reset, data, form]);

const onSubmit = async (data: EnviromentSchema) => {
const onSubmit = async (data: EnvironmentSchema) => {
mutateAsync({
env: data.enviroment,
env: data.environment,
mariadbId,
})
.then(async () => {
toast.success("Enviroments Added");
toast.success("Environments Added");
await refetch();
})
.catch(() => {
toast.error("Error to add enviroment");
toast.error("Error to add environment");
});
};

return (
<div className="flex w-full flex-col gap-5 ">
<Card className="bg-background">
<CardHeader>
<CardTitle className="text-xl">Enviroment Settings</CardTitle>
<CardTitle className="text-xl">Environment Settings</CardTitle>
<CardDescription>
You can add enviroment variables to your database.
You can add environment variables to your database.
</CardDescription>
</CardHeader>
<CardContent>
Expand All @@ -89,7 +89,7 @@ export const ShowMariadbEnviroment = ({ mariadbId }: Props) => {
>
<FormField
control={form.control}
name="enviroment"
name="environment"
render={({ field }) => (
<FormItem className="w-full">
<FormControl>
Expand Down
Loading

0 comments on commit de278d9

Please sign in to comment.