Skip to content

Commit

Permalink
fix db error and segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
MXWXZ committed May 29, 2024
1 parent 362de81 commit 7cf8798
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.1.3
## Bug fix
1. Fix login db error when using PostgreSQL.
2. Fix plugin segmentation fault in some systems.

# 0.1.2
## Bug fix
1. Fix CSP violation for reCAPTCHA.
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SHELL = /bin/bash
.SHELLFLAGS = -
OUTPUT_DIR = $$(pwd)/bin
TARGET_DIR = $$(pwd)/target
PLUGIN_DIR = $$(pwd)/plugin
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ Security is considered as **TOP** priority in Skynet, we will not consider featu
### Run in docker

1. Copy `docker-compose.yml` and `conf.yml` to your folder.
2. `mkdir plugin` and `mkdir -p assets/_plugin`, then add your plugins.
3. `touch data.db` or copy your existing database.
4. `docker-compose up`
5. Visit `localhost:8080`.
2. `docker-compose up`
3. Visit `localhost:8080`.

### Run natively

Expand Down
2 changes: 1 addition & 1 deletion conf.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# yaml-language-server: $schema=conf.schema.json
database:
dsn: "sqlite://data.db?mode=rwc" # database dsn, support sqlite, mysql, postgresql
dsn: "postgres://postgres:changeme@db:5432/skynet" # database dsn, support sqlite, mysql, postgresql

redis:
dsn: "redis://redis:6379/0" # redis dsn
Expand Down
9 changes: 8 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ services:
- ./plugin/:/app/plugin
- ./assets/_plugin/:/app/assets/_plugin
- ./conf.yml:/app/conf.yml
- ./data.db:/app/data.db
ports:
- "8080:8080"
redis:
image: redis:alpine
restart: always
db:
image: postgres
restart: always
volumes:
- ./data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: changeme
POSTGRES_DB: skynet
2 changes: 1 addition & 1 deletion migration/src/m20220101_000001_create_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl MigrationTrait for Migration {
.unique_key()
.not_null(),
)
.col(ColumnDef::new(Users::Password).char_len(128).not_null())
.col(ColumnDef::new(Users::Password).string_len(128).not_null())
.col(ColumnDef::new(Users::Avatar).binary())
.col(ColumnDef::new(Users::LastLogin).big_integer())
.col(ColumnDef::new(Users::LastIP).string_len(64))
Expand Down
1 change: 0 additions & 1 deletion plugin/agent/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SHELL = /bin/bash
.SHELLFLAGS = -
PLATFORM =
MACHINE =
SUFFIX =
Expand Down
2 changes: 1 addition & 1 deletion skynet/src/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl RootSpanBuilder for SpanBuilder {
let end_time = Utc::now();
let time = (end_time - req.start_time).num_microseconds().unwrap_or(0);
if let Some(error) = response.response().error() {
error!(
info!(
_time = end_time.timestamp_micros(),
code = %response.status().as_u16(),
error = %error.as_response_error(),
Expand Down
2 changes: 1 addition & 1 deletion skynet/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ impl PluginManager {
}
}
if !i.status.is_enable() {
i.instance = None; // instance MUST be released before library
i.library = None;
i.instance = None;
}
}
self.plugin = RwLock::new(instance.into_iter().map(Arc::new).collect());
Expand Down

0 comments on commit 7cf8798

Please sign in to comment.