mirror of
https://github.com/mruwnik/chicken-master.git
synced 2025-06-08 21:34:43 +02:00
basic db backup script
This commit is contained in:
parent
9a79be1f78
commit
67464f1d46
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,8 @@
|
||||
backend/.cpcache/
|
||||
backend/.nrepl-port
|
||||
backend/chicken-master.jar
|
||||
|
||||
frontend/.cpcache/
|
||||
/frontend/out/
|
||||
/frontend/resources/public/js
|
||||
/frontend/resources/public/css
|
||||
|
@ -11,13 +11,7 @@ See the READMEs in the `backend` and `frontend` folders.
|
||||
* daily view
|
||||
* infinite scroll
|
||||
|
||||
* Move to different day
|
||||
|
||||
* handle regular customers
|
||||
** every n days
|
||||
** copy over to next week
|
||||
** cancel regular order
|
||||
|
||||
* settings menu
|
||||
|
||||
* products CRM
|
||||
|
@ -20,4 +20,4 @@ The API for the chickens service.
|
||||
## Deployment
|
||||
|
||||
clojure -X:depstar uberjar
|
||||
java -jar chickens.jar -Dconfig=config/dev/config.edn
|
||||
java -Dconfig=config/dev/config.edn -jar chickens.jar
|
||||
|
@ -1,13 +1,13 @@
|
||||
{:paths ["src" "resources"]
|
||||
:deps {org.clojure/clojure {:mvn/version "1.10.1"}
|
||||
ns-tracker {:mvn/version "0.4.0"}
|
||||
compojure {:mvn/version "1.6.2"}
|
||||
ns-tracker/ns-tracker {:mvn/version "0.4.0"}
|
||||
compojure/compojure {:mvn/version "1.6.2"}
|
||||
yogthos/config {:mvn/version "1.1.7"}
|
||||
seancorfield/next.jdbc {:mvn/version "1.1.613"}
|
||||
org.postgresql/postgresql {:mvn/version "42.2.6"}
|
||||
ring-basic-authentication {:mvn/version "1.1.0"}
|
||||
ring-cors {:mvn/version "0.1.13"}
|
||||
ring {:mvn/version "1.8.1"}}
|
||||
ring-basic-authentication/ring-basic-authentication {:mvn/version "1.1.0"}
|
||||
ring-cors/ring-cors {:mvn/version "0.1.13"}
|
||||
ring/ring {:mvn/version "1.8.1"}}
|
||||
|
||||
:aliases
|
||||
{:dev {:jvm-opts ["-Dconfig=config/dev/config.edn"]
|
||||
@ -20,4 +20,4 @@
|
||||
:depstar {:replace-deps
|
||||
{com.github.seancorfield/depstar {:mvn/version "2.0.193"}}
|
||||
:ns-default hf.depstar
|
||||
:exec-args {:aot true :jar "chickens.jar" :main-class chicken-master.server}}}}
|
||||
:exec-args {:aot true :jar "chicken-master.jar" :main-class chicken-master.server}}}}
|
||||
|
@ -3,7 +3,7 @@
|
||||
[chicken-master.api :as endpoints]
|
||||
[clojure.edn :as edn]
|
||||
[config.core :refer [env]]
|
||||
[compojure.core :refer [GET defroutes routes]]
|
||||
[compojure.core :refer [GET defroutes routes context]]
|
||||
[compojure.route :refer [resources not-found]]
|
||||
[compojure.handler :refer [api]]
|
||||
[ring.util.response :refer [resource-response]]
|
||||
@ -39,11 +39,12 @@
|
||||
(not-found "not found"))
|
||||
|
||||
(def handler (routes
|
||||
(-> endpoints/all-routes
|
||||
(wrap-basic-authentication authenticated?)
|
||||
(wrap-cors :access-control-allow-origin (map re-pattern (env :allow-origin))
|
||||
:access-control-allow-methods [:get :put :post :delete :options])
|
||||
api
|
||||
wrap-edn-request
|
||||
wrap-edn-response)
|
||||
(context "/api" []
|
||||
(-> endpoints/all-routes
|
||||
(wrap-basic-authentication authenticated?)
|
||||
(wrap-cors :access-control-allow-origin (map re-pattern (env :allow-origin))
|
||||
:access-control-allow-methods [:get :put :post :delete :options])
|
||||
api
|
||||
wrap-edn-request
|
||||
wrap-edn-response))
|
||||
base-routes))
|
||||
|
14
deploy.sh
Executable file
14
deploy.sh
Executable file
@ -0,0 +1,14 @@
|
||||
cd backend
|
||||
clojure -X:depstar uberjar
|
||||
|
||||
cd ../frontend
|
||||
npx shadow-cljs release frontend
|
||||
clojure -A:garden -m chicken-master.css
|
||||
|
||||
cd ..
|
||||
scp backend/chicken-master.jar chickens:/srv/chickens/chicken-master.jar
|
||||
ssh chickens 'mkdir -p /srv/chickens/frontend/js'
|
||||
ssh chickens 'mkdir -p /srv/chickens/frontend/css'
|
||||
rsync -r frontend/resources/public/index.html chickens:/srv/chickens/frontend/index.html
|
||||
rsync -r frontend/resources/public/css/screen.css chickens:/srv/chickens/frontend/css/screen.css
|
||||
rsync -r frontend/resources/public/js/app.js chickens:/srv/chickens/frontend/js/app.js
|
0
frontend/resources/public/css/screen.css
Normal file
0
frontend/resources/public/css/screen.css
Normal file
@ -33,7 +33,7 @@
|
||||
:editable-number-inputs (get-setting :editable-number-inputs false) ; only allow number modifications in the edit modal
|
||||
:hide-fulfilled-orders (get-setting :hide-fulfilled-orders false)
|
||||
|
||||
:backend-url (get-setting :backend-url (.. js/window -location -href)) ; "http://localhost:3000/"
|
||||
:backend-url (get-setting :backend-url (str (.. js/window -location -href) "api/")) ; "http://localhost:3000/"
|
||||
})
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@ Description=Chicken master
|
||||
After=postgresql.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/java -Dconfig="/home/dan/chicken-master/config.edn" -jar /home/dan/chicken-master/target/chicken-master.jar
|
||||
ExecStart=/usr/bin/java -Dconfig="/srv/chickens/config.edn" -jar /srv/chickens/chicken-master.jar
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
|
8
infra/db/pg_backup.sh
Executable file
8
infra/db/pg_backup.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
DB_URI="postgresql://localhost/chickens?user=chicken_user&password="
|
||||
|
||||
BACKUP_DIR=/srv/chickens/backups/
|
||||
BACKUP_FILE=$BACKUP_DIR"`date +\%Y-\%m-\%d`.sql"
|
||||
|
||||
pg_dump -Fp "$DB_URI" | gzip > $BACKUP_FILE.gz
|
Loading…
x
Reference in New Issue
Block a user