updated script with db
This commit is contained in:
parent
109fb46950
commit
cb3a6bd9c6
@ -61,29 +61,115 @@ DROP TABLE IF EXISTS "master_beacons";
|
|||||||
DROP TABLE IF EXISTS "pages";
|
DROP TABLE IF EXISTS "pages";
|
||||||
|
|
||||||
|
|
||||||
|
-- SEQUENCES
|
||||||
|
|
||||||
|
|
||||||
|
-- Sequence: public.billing_id_seq
|
||||||
|
|
||||||
-- Table: public.billing
|
-- DROP SEQUENCE public.billing_id_seq;
|
||||||
|
|
||||||
-- DROP TABLE public.billing;
|
CREATE SEQUENCE public.billing_id_seq
|
||||||
|
INCREMENT 1
|
||||||
CREATE TABLE public.billing
|
MINVALUE 1
|
||||||
(
|
MAXVALUE 9223372036854775807
|
||||||
id integer NOT NULL DEFAULT nextval('billing_id_seq'::regclass),
|
START 1
|
||||||
company_id integer NOT NULL,
|
CACHE 1;
|
||||||
CONSTRAINT billing_pk PRIMARY KEY (id),
|
ALTER TABLE public.billing_id_seq
|
||||||
CONSTRAINT billing_fk0 FOREIGN KEY (company_id)
|
|
||||||
REFERENCES public.company (id) MATCH SIMPLE
|
|
||||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
|
||||||
)
|
|
||||||
WITH (
|
|
||||||
OIDS=FALSE
|
|
||||||
);
|
|
||||||
ALTER TABLE public.billing
|
|
||||||
OWNER TO postgres;
|
OWNER TO postgres;
|
||||||
GRANT SELECT, UPDATE, INSERT ON TABLE public.billing TO public;
|
|
||||||
GRANT ALL ON TABLE public.billing TO postgres;
|
|
||||||
|
|
||||||
|
-- Sequence: public.company_id_seq
|
||||||
|
|
||||||
|
-- DROP SEQUENCE public.company_id_seq;
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.company_id_seq
|
||||||
|
INCREMENT 1
|
||||||
|
MINVALUE 1
|
||||||
|
MAXVALUE 9223372036854775807
|
||||||
|
START 2
|
||||||
|
CACHE 1;
|
||||||
|
ALTER TABLE public.company_id_seq
|
||||||
|
OWNER TO postgres;
|
||||||
|
GRANT ALL ON SEQUENCE public.company_id_seq TO postgres;
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCE public.company_id_seq TO obrand;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Sequence: public.logins_id_seq
|
||||||
|
|
||||||
|
-- DROP SEQUENCE public.logins_id_seq;
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.logins_id_seq
|
||||||
|
INCREMENT 1
|
||||||
|
MINVALUE 1
|
||||||
|
MAXVALUE 9223372036854775807
|
||||||
|
START 4
|
||||||
|
CACHE 1;
|
||||||
|
ALTER TABLE public.logins_id_seq
|
||||||
|
OWNER TO postgres;
|
||||||
|
GRANT ALL ON SEQUENCE public.logins_id_seq TO postgres;
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCE public.logins_id_seq TO obrand;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Sequence: public.pages_id_seq
|
||||||
|
|
||||||
|
-- DROP SEQUENCE public.pages_id_seq;
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.pages_id_seq
|
||||||
|
INCREMENT 1
|
||||||
|
MINVALUE 1
|
||||||
|
MAXVALUE 9223372036854775807
|
||||||
|
START 35
|
||||||
|
CACHE 1;
|
||||||
|
ALTER TABLE public.pages_id_seq
|
||||||
|
OWNER TO postgres;
|
||||||
|
GRANT ALL ON SEQUENCE public.pages_id_seq TO postgres;
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCE public.pages_id_seq TO obrand;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Sequence: public.profile_id_seq
|
||||||
|
|
||||||
|
-- DROP SEQUENCE public.profile_id_seq;
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.profile_id_seq
|
||||||
|
INCREMENT 1
|
||||||
|
MINVALUE 1
|
||||||
|
MAXVALUE 9223372036854775807
|
||||||
|
START 2
|
||||||
|
CACHE 1;
|
||||||
|
ALTER TABLE public.profile_id_seq
|
||||||
|
OWNER TO postgres;
|
||||||
|
GRANT ALL ON SEQUENCE public.profile_id_seq TO postgres;
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCE public.profile_id_seq TO obrand;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Sequence: public.venue_id_seq
|
||||||
|
|
||||||
|
-- DROP SEQUENCE public.venue_id_seq;
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.venue_id_seq
|
||||||
|
INCREMENT 1
|
||||||
|
MINVALUE 1
|
||||||
|
MAXVALUE 9223372036854775807
|
||||||
|
START 1
|
||||||
|
CACHE 1;
|
||||||
|
ALTER TABLE public.venue_id_seq
|
||||||
|
OWNER TO postgres;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- ----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -122,6 +208,34 @@ GRANT ALL ON TABLE public.company TO postgres;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Table: public.billing
|
||||||
|
|
||||||
|
-- DROP TABLE public.billing;
|
||||||
|
|
||||||
|
CREATE TABLE public.billing
|
||||||
|
(
|
||||||
|
id integer NOT NULL DEFAULT nextval('billing_id_seq'::regclass),
|
||||||
|
company_id integer NOT NULL,
|
||||||
|
CONSTRAINT billing_pk PRIMARY KEY (id),
|
||||||
|
CONSTRAINT billing_fk0 FOREIGN KEY (company_id)
|
||||||
|
REFERENCES public.company (id) MATCH SIMPLE
|
||||||
|
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||||
|
)
|
||||||
|
WITH (
|
||||||
|
OIDS=FALSE
|
||||||
|
);
|
||||||
|
ALTER TABLE public.billing
|
||||||
|
OWNER TO postgres;
|
||||||
|
GRANT SELECT, UPDATE, INSERT ON TABLE public.billing TO public;
|
||||||
|
GRANT ALL ON TABLE public.billing TO postgres;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Table: public.logins
|
-- Table: public.logins
|
||||||
|
|
||||||
-- DROP TABLE public.logins;
|
-- DROP TABLE public.logins;
|
||||||
@ -275,12 +389,12 @@ GRANT ALL ON TABLE public.venue TO postgres;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE "profile" ADD CONSTRAINT "profile_fk0" FOREIGN KEY ("uid") REFERENCES "logins"("uid");
|
--ALTER TABLE "profile" ADD CONSTRAINT "profile_fk0" FOREIGN KEY ("uid") REFERENCES "logins"("uid");
|
||||||
--ALTER TABLE "profile" ADD CONSTRAINT "profile_fk1" FOREIGN KEY ("member_of") REFERENCES "company"("cid");
|
--ALTER TABLE "profile" ADD CONSTRAINT "profile_fk1" FOREIGN KEY ("member_of") REFERENCES "company"("cid");
|
||||||
|
|
||||||
ALTER TABLE "venue" ADD CONSTRAINT "venue_fk0" FOREIGN KEY ("company_id") REFERENCES "company"("id");
|
--ALTER TABLE "venue" ADD CONSTRAINT "venue_fk0" FOREIGN KEY ("company_id") REFERENCES "company"("id");
|
||||||
|
|
||||||
ALTER TABLE "billing" ADD CONSTRAINT "billing_fk0" FOREIGN KEY ("company_id") REFERENCES "company"("id");
|
--ALTER TABLE "billing" ADD CONSTRAINT "billing_fk0" FOREIGN KEY ("company_id") REFERENCES "company"("id");
|
||||||
|
|
||||||
grant connect on database "oBrand" to obrand;
|
grant connect on database "oBrand" to obrand;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ NVM_VERSION="5.7.0"
|
|||||||
DEV="$HOME/dev"
|
DEV="$HOME/dev"
|
||||||
LIVE="$HOME/live"
|
LIVE="$HOME/live"
|
||||||
SWAP="/swapfile"
|
SWAP="/swapfile"
|
||||||
|
DBSETUP="obrand-admin-server/dbrebuild.sh"
|
||||||
|
|
||||||
fancy_echo() {
|
fancy_echo() {
|
||||||
local fmt="$1"; shift
|
local fmt="$1"; shift
|
||||||
@ -19,7 +20,7 @@ sudo apt-get -y -q --force-yes update
|
|||||||
# sudo apt-get -y -q --force-yes upgrade
|
# sudo apt-get -y -q --force-yes upgrade
|
||||||
|
|
||||||
# install apps
|
# install apps
|
||||||
sudo apt-get --assume-yes install build-essential git nginx htop screen wget curl postgresql-9.4
|
sudo apt-get --assume-yes install build-essential git nginx htop screen wget curl postgresql postgresql-contrib
|
||||||
|
|
||||||
# set up and install swap file
|
# set up and install swap file
|
||||||
if [[ ! -f "$SWAP" ]]; then
|
if [[ ! -f "$SWAP" ]]; then
|
||||||
@ -81,6 +82,12 @@ cd $DEV/O-Brand/dist
|
|||||||
cp -ra . $DEV/obrand-admin-server/wwwroot
|
cp -ra . $DEV/obrand-admin-server/wwwroot
|
||||||
|
|
||||||
cd $DEV/obrand-admin-server
|
cd $DEV/obrand-admin-server
|
||||||
|
|
||||||
|
echo Setting up Database server...
|
||||||
|
|
||||||
|
sudo su - postgres -c "$DEV/$DBSETUP"
|
||||||
|
|
||||||
|
echo Copying...
|
||||||
rsync -uav --exclude .git $DEV/obrand-admin-server/ $LIVE
|
rsync -uav --exclude .git $DEV/obrand-admin-server/ $LIVE
|
||||||
|
|
||||||
# Configure nginx
|
# Configure nginx
|
||||||
|
Loading…
Reference in New Issue
Block a user