-
Notifications
You must be signed in to change notification settings - Fork 7
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
Postgres #39
Postgres #39
Conversation
Really interesting @juancarlospaco!! I'm looking forward to checkout it out - I'm having time in week 3.
|
|
I'm okay with docker as a supplement, but I'm not all-in for it. I will not be using Docker on my instances, and I still need to have the possibility for a quick deployment with SQLite. Furthermore I have NimWC deployed across multiple instances, which all uses SQLite DB's - moving away from SQLite would be a breaking change. We are currently not using any Postgres query-features, which can't run in a SQLite environment, so a user defined backend would be the best. when defined(sqlite):
import db_sqlite
else:
import db_postgres |
Yes, but I am doing the postgres first on the code, then when it works will do another pass adding a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really good PR! I really like your optimizations and the prettiness of the code 😃
I started to comment on the formatting # Heading #######
, so there's a lot of redundant comments, but it felt weird to stop half-through. Sorry.
Some of my comments is on my own legacy code and formulations. Let me know if you would have me to update these.
I haven't tested the code yet - please let me know, when I should try to run it.
I'm not experienced in Docker - so I'll rely on your own review of that part.
I noticed that you refer to ormin as ORMin
. I don't mind, but I just noticed that it's referred as ormin
in the repo. I'm still novice in the nim-ormin package, so I'm looking forward to play around with it :)
Thank you for this large contribution!
nimwcpkg/resources/web/routes.nim
Outdated
get "/settings/serverinfo": | ||
createTFD() | ||
restrictAccessTo(c, [Admin, Moderator]) | ||
resp genServerInfo() | ||
|
||
|
||
#[ | ||
# Files ####################################################################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment about macros
nimwcpkg/resources/web/routes.nim
Outdated
@@ -442,14 +425,9 @@ routes: | |||
resp("Error: File not found") | |||
|
|||
|
|||
# Users ####################################################################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment about macros
nimwcpkg/resources/web/routes.nim
Outdated
except: | ||
resp("Error") | ||
|
||
resp("Error: Something went wrong") | ||
|
||
# Blog ######################################################################## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment about macros
nimwcpkg/resources/web/routes.nim
Outdated
@@ -680,19 +646,13 @@ routes: | |||
resp genPageBlog(c, blogid) | |||
|
|||
|
|||
# Pages ####################################################################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment about macros
nimwcpkg/resources/web/routes.nim
Outdated
@@ -757,11 +714,9 @@ routes: | |||
resp genPage(c, pageid) | |||
|
|||
|
|||
#[ | |||
# Sitemap ##################################################################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment about macros
ormin is basically SQL Pseudo-code, so if you understand SQL, you kinda already know ormin. Later I will add instructions for Docker and Vagrant. All feedback is implemented. |
Whats the difference between because when defined(dev):
echo something What if we drop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Literally copy & pasted code without changing it from nimwc
to datetime2human
since we have very similar code,
migrated from NimWC to clean out code, benefits both projects, and added you as a repo admin there too.
Nice, good choice. I like the names |
Where have you found that? Is it 1 instance or remove defined(dev) in general?
|
I hit a critical problem with Then I improved Gatabase adding SQLite via a compile time parameter and other improvements, |
Question: What should our users standard DB be? SQLite or Postgres? We currently have I would prefer sqlite as standard. It makes it easier for a user to try NimWC without setting up a Postgres DB. What do you think? |
@ThomasTJdev I agree 👍 |
…and accessing settings table
@@ -182,7 +182,7 @@ | |||
<div class="field"> | |||
<div class="control"> | |||
<label class="label">Publication date (visible on the blog overview)</label> | |||
<input class="input" type="text" name="pubdate" value="${pubDate}" dir="auto"> | |||
<input class="input" type="date" name="pubdate" value="${pubDate}" min="${pubDate}" dir="auto" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" required > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shows the date as MM/DD/YYYY - instead of YYYY-MM-DD or DD/MM/YYYY.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats Cosmetic, the Date is Auto Locale aware, kinda the browser Pretty Print it for you.
Over the wire is just YYYY-MM-DD
@juancarlospaco I'm ready for merging 😃 . You just say go, when you are ready! |
@ThomasTJdev GO ❕ |
@ThomasTJdev Need to Re-Deploy the Demo. |
I'm having 3 problems 😞 Nimble fileShould we remove this line? It is a bin-file, so Nimble should compile it itself. exec "nim c -r -d:release -d:ssl nimwc.nim" FirejailWhen running I get this: ubuntu@development:~/tmp/nim_websitecreator$ nimwc
2019-03-01T21:54:21+00:00: Nim Website Creator: Launcher starting.
Error: invalid --keep-dev-shm command line option
2019-03-01T21:54:23+00:00: Restarting in 1 second.
Error: invalid --keep-dev-shm command line option
2019-03-01T21:54:26+00:00: Restarting in 1 second.
^CError: unhandled exception: No such process [OSError] The problem could be, that nimble does not copy nimwc.nim.cfg to the nimble/pkgs directory. Therefore firejail is missing when compiling to run. |
Remove the line if you want, you are right. For the Demo you can compile without Firejail. Are you sure you have the latest Firejail module?, you ran I updated both Firejail and WebP during this Pull Request, so reinstall them to update them. |
This is a clean test install the server. I can compile without firejail. I have the newest firejail-nim module from nimble. Firejail version:
I'm using the raw config.cfg - no changes has been made. |
If you want leave the Demo without Firejail, whatever you like no problem. Everything seems Ok, your Distro just ship too old Firejail. |
Demo without firejail is ok. Is v
|
They have the
But being kinda security package I dont feel like supporting legacy or deprecated too much lol. Whatsoever is Distros fault not our fault. |
I like the security approach, but it could make it hard to support AWS Ubuntu images or Raspberry Pi's. RPi has a backport version 9.44. Can you compile on a RPi? I'm having trouble (with and without firejail). nimwc_main.nim(582, 15) template/generic instantiation of `generateRoutes` from here
/home/pi/nim/Nim/lib/core/macros.nim(496, 1) template/generic instantiation of `routes` from here
../../jester-0.4.1/jester.nim(1269, 35) template/generic instantiation of `async` from here
resources/email/email_registration.nim(48, 6) Warning: 'sendEmailActivationManual' is not GC-safe as it calls 'sendEmailActivationManual_continue' [GcUnsafe2]
nimwc_main.nim(582, 15) template/generic instantiation of `generateRoutes` from here
/home/pi/nim/Nim/lib/core/macros.nim(496, 1) template/generic instantiation of `routes` from here
../../jester-0.4.1/jester.nim(1269, 35) template/generic instantiation of `async` from here
/home/pi/nim/Nim/lib/pure/asyncmacro.nim(267, 31) Warning: 'matchIter' is not GC-safe as it calls 'sendEmailActivationManual' [GcUnsafe2]
/home/pi/nim/Nim/lib/core/macros.nim(1214, 49) Error: conversion from int64 to int is invalid
Compile Error
⚠️ Compile-time or Configuration or Plugin error occurred.
➡️ You can check your source code with: nim check YourFile.nim
➡️ Check the Configuration of NimWC and its Plugins.
➡️ Remove new Plugins, restore previous Configuration.
Check that you have the latest Version. Check the Documentation. |
www.nimwc.org is up and running with firejail 😃 (I need to perform some upgrades, so there might be a little downtime next hour) If |
I have tried compiling from source, but with no luck. Have you had any luck upgrading firejail on a RPi? If we can't support RPi out of the box, we should:
Jessie or stretchI'm currently running jessie on the testing RPi. I'll update to stretch and test. |
Have you tried ArchLinux on it?, maybe is Distro-specific Bug. |
Stretch has firejail |
Feel free to Edit, Suggest, Comment, Push, etc.