Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from UnownHash/simplify-setup
Browse files Browse the repository at this point in the history
simplify setup
  • Loading branch information
TurtIeSocks authored Apr 18, 2023
2 parents 40439dc + 285e941 commit 1ad50ba
Show file tree
Hide file tree
Showing 24 changed files with 8,241 additions and 3,665 deletions.
63 changes: 63 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"root": true,
"ignorePatterns": [
"**/*"
],
"plugins": [
"@nrwl/nx"
],
"extends": [
"plugin:prettier/recommended"
],
"rules": {
"react-hooks/exhaustive-deps": "off",
"react/jsx-no-useless-fragment": "off"
},
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": [
"*"
]
}
]
}
]
}
},
{
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@nrwl/nx/typescript"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"extends": [
"plugin:@nrwl/nx/javascript"
],
"rules": {}
}
]
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ ecosystem.config.js
# Builds
dist
/server/server

.nx/installation
.nx/cache
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
FROM node:18-alpine as client
WORKDIR /app
COPY ./package.json ./package.json
COPY ./yarn.lock ./yarn.lock
COPY ./.eslintrc.json ./.eslintrc.json
COPY ./client ./client
RUN cd client && yarn install
RUN cd client && yarn build
RUN yarn install
RUN yarn build:client

FROM golang:1.20.2-alpine3.17 as server
WORKDIR /app
COPY . .
RUN cd server && go build -o Admin

FROM golang:1.20.2-alpine3.17
COPY --from=client /app/dist ./dist
COPY --from=client /app/dist/client ./dist/client
COPY --from=server /app/server/Admin Admin
CMD ["./Admin"]
125 changes: 55 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,120 +14,117 @@

1. Clone Repo

```bash
git clone https://github.com/UnownHash/Flygon-Admin.git
```
```bash
git clone https://github.com/UnownHash/Flygon-Admin.git
```

1. Change Directory to the Repo

```bash
cd Flygon-Admin
```
```bash
cd Flygon-Admin
```

1. Create the config file

```bash
cp config.toml.example config.toml
```
```bash
cp config.toml.example config.toml
```

1. Fill out the config file

```bash
nano config.toml
```
```bash
nano config.toml
```

1. Compile the client
1. Install dependencies

```bash
cd client
yarn install
yarn build
```
```bash
yarn install
```

1. Compile the server
1. Compile the client and server

```bash
cd ../server
go build
```
```bash
yarn build
```

1. Run server
1. Run

```bash
./server
```
```bash
yarn start
```

### Updating

1. Pull repo

```bash
git pull
```
```bash
git pull
```

1. Repeat steps 5-7 from the [standard setup](#standard-setup)

## PM2 Setup

1. Install PM2

```bash
npm install pm2 -g
```
```bash
npm install pm2 -g
```

1. Follow steps 1-6 from the [standard setup](#standard-setup)
1. From the `server` directory, add to PM2:
1. From the `root` directory, add to PM2:

```bash
pm2 start server --name "Flygon-Admin"
```
```bash
pm2 start "yarn start" --name "Flygon-Admin"
```

1. Save PM2 processes

```bash
pm2 save
```
```bash
pm2 save
```

### Updating

1. Follow steps 5-6 from the [standard setup](#standard-setup)
1. Restart PM2 process

```bash
pm2 restart Flygon-Admin
```
```bash
pm2 restart Flygon-Admin
```

## Docker Setup

1. Clone Repo

```bash
git clone https://github.com/UnownHash/Flygon-Admin.git
```
```bash
git clone https://github.com/UnownHash/Flygon-Admin.git
```

1. Change Directory to the Repo

```bash
cd Flygon-Admin
```
```bash
cd Flygon-Admin
```

1. Copy docker-compose file

```bash
cp docker-compose.yml docker-compose.override.yml
```
```bash
cp docker-compose.yml docker-compose.override.yml
```

1. Fill out the docker-compose.override.yml file, not the docker-compose.yml file

```bash
nano docker-compose.override.yml
```
```bash
nano docker-compose.override.yml
```

1. Run docker-compose

```bash
docker-compose up -d
```
```bash
docker-compose up -d
```

### Updating

Expand All @@ -144,21 +141,9 @@ docker-compose up -d
1. Same as above
1. [gow](https://github.com/bmatzelle/gow) (Recommended)

### Terminal 1

Run the client in dev mode with hot reloading

```bash
cd client
yarn install
yarn dev
```

### Terminal 2

Run the server in dev mode with file watching

```bash
cd server
gow run . # or go run .
```
4 changes: 0 additions & 4 deletions client/.eslintignore

This file was deleted.

67 changes: 0 additions & 67 deletions client/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 1ad50ba

Please sign in to comment.