Commit 36ae6096 authored by ham's avatar ham

Add postgres docker image

parent e3ac568c
Pipeline #66959 passed with stages
in 1 minute and 20 seconds
......@@ -346,6 +346,7 @@ The visualization service can be accessed under:
There is one last thing to do before visualization service is available. Login to the admin panel, go to server -> webserver and activate the websocket service. Click sumbit button and restart button. After that, the visualization service is good to go.
Note there is a file `./docker/World.zone.xml`. It's a config file generated by smartfox after following the instruction in previous `Configuration` section. If you want to change any configuration, simply use the smartfox admin panel will do the work.
Although this smartfox image is currently set to use SQLite as default database, one can also use Postgres as database. To do so, follow step 3 of Server configuration above, when it comes to __Connection string__ setting, instead of using
`jdbc:postgresql://localhost:5432/mmosim`, use `jdbc:postgresql://postgres:5432/server` as __Connection string__.
FROM postgres:latest
COPY ./db-create-script.sql /docker-entrypoint-initdb.d/
\ No newline at end of file
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: area; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE area (
id integer NOT NULL,
minx double precision NOT NULL,
miny double precision NOT NULL,
minz double precision NOT NULL,
maxx double precision NOT NULL,
maxy double precision NOT NULL,
maxz double precision NOT NULL
);
ALTER TABLE area OWNER TO server;
--
-- Name: area_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE area_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE area_id_seq OWNER TO server;
--
-- Name: area_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE area_id_seq OWNED BY area.id;
--
-- Name: entry_node; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE entry_node (
sector_id bigint NOT NULL,
node_osm_id bigint NOT NULL
);
ALTER TABLE entry_node OWNER TO server;
--
-- Name: env_node; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE env_node (
id integer NOT NULL,
x double precision NOT NULL,
y double precision NOT NULL,
z double precision NOT NULL,
osmid bigint NOT NULL,
env_object_id integer NOT NULL,
isintersection smallint NOT NULL
);
ALTER TABLE env_node OWNER TO server;
--
-- Name: env_node_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE env_node_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE env_node_id_seq OWNER TO server;
--
-- Name: env_node_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE env_node_id_seq OWNED BY env_node.id;
--
-- Name: env_object; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE env_object (
id integer NOT NULL,
tag character varying(255) NOT NULL,
osmid bigint NOT NULL,
map_id integer NOT NULL
);
ALTER TABLE env_object OWNER TO server;
--
-- Name: env_object_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE env_object_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE env_object_id_seq OWNER TO server;
--
-- Name: env_object_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE env_object_id_seq OWNED BY env_object.id;
--
-- Name: map; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE map (
id integer NOT NULL,
mname character varying(255) NOT NULL,
src character varying(255) NOT NULL
);
ALTER TABLE map OWNER TO server;
--
-- Name: map_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE map_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE map_id_seq OWNER TO server;
--
-- Name: map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE map_id_seq OWNED BY map.id;
--
-- Name: overlap_area; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE overlap_area (
id integer NOT NULL,
overlap_a integer NOT NULL,
overlap_b integer NOT NULL,
area_id integer NOT NULL
);
ALTER TABLE overlap_area OWNER TO server;
--
-- Name: overlap_area_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE overlap_area_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE overlap_area_id_seq OWNER TO server;
--
-- Name: overlap_area_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE overlap_area_id_seq OWNED BY overlap_area.id;
--
-- Name: path; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE path (
sector_id bigint NOT NULL,
source bigint NOT NULL,
target bigint NOT NULL,
distance double precision
);
ALTER TABLE path OWNER TO server;
--
-- Name: scenario; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE scenario (
id integer NOT NULL,
sname character varying(255) NOT NULL,
map_id integer NOT NULL
);
ALTER TABLE scenario OWNER TO server;
--
-- Name: scenario_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE scenario_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE scenario_id_seq OWNER TO server;
--
-- Name: scenario_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE scenario_id_seq OWNED BY scenario.id;
--
-- Name: sector; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE sector (
id integer NOT NULL,
map_id integer NOT NULL,
area_id integer NOT NULL
);
ALTER TABLE sector OWNER TO server;
--
-- Name: sector_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE sector_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE sector_id_seq OWNER TO server;
--
-- Name: sector_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE sector_id_seq OWNED BY sector.id;
--
-- Name: street; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE street (
id integer NOT NULL,
speed_limit integer NOT NULL,
width double precision NOT NULL,
isoneway smallint NOT NULL,
env_object_id integer NOT NULL,
street_type character varying(255)
);
ALTER TABLE street OWNER TO server;
--
-- Name: street_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE street_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE street_id_seq OWNER TO server;
--
-- Name: street_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE street_id_seq OWNED BY street.id;
--
-- Name: street_sign; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE street_sign (
id integer NOT NULL,
ss_type character varying(255) NOT NULL,
ss_state character varying(255) NOT NULL,
isone smallint NOT NULL,
istwo smallint NOT NULL,
x1 double precision NOT NULL,
y1 double precision NOT NULL,
z1 double precision NOT NULL,
x2 double precision NOT NULL,
y2 double precision NOT NULL,
z2 double precision NOT NULL,
env_node_id integer NOT NULL
);
ALTER TABLE street_sign OWNER TO server;
--
-- Name: street_sign_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE street_sign_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE street_sign_id_seq OWNER TO server;
--
-- Name: street_sign_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE street_sign_id_seq OWNED BY street_sign.id;
--
-- Name: track; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE track (
id integer NOT NULL,
tname character varying(50) NOT NULL,
scenario_id integer NOT NULL
);
ALTER TABLE track OWNER TO server;
--
-- Name: track_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE track_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE track_id_seq OWNER TO server;
--
-- Name: track_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE track_id_seq OWNED BY track.id;
--
-- Name: track_section; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE track_section (
id integer NOT NULL,
track_id bigint,
source bigint NOT NULL,
target bigint NOT NULL,
sector_id bigint NOT NULL
);
ALTER TABLE track_section OWNER TO server;
--
-- Name: track_section_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE track_section_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE track_section_id_seq OWNER TO server;
--
-- Name: track_section_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE track_section_id_seq OWNED BY track_section.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE users (
id integer NOT NULL,
uname character varying(255) NOT NULL,
passwd character varying(255) NOT NULL
);
ALTER TABLE users OWNER TO server;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE users_id_seq OWNER TO server;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE users_id_seq OWNED BY users.id;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY area ALTER COLUMN id SET DEFAULT nextval('area_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY env_node ALTER COLUMN id SET DEFAULT nextval('env_node_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY env_object ALTER COLUMN id SET DEFAULT nextval('env_object_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY map ALTER COLUMN id SET DEFAULT nextval('map_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY overlap_area ALTER COLUMN id SET DEFAULT nextval('overlap_area_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY scenario ALTER COLUMN id SET DEFAULT nextval('scenario_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY sector ALTER COLUMN id SET DEFAULT nextval('sector_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY street ALTER COLUMN id SET DEFAULT nextval('street_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY street_sign ALTER COLUMN id SET DEFAULT nextval('street_sign_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY track ALTER COLUMN id SET DEFAULT nextval('track_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY track_section ALTER COLUMN id SET DEFAULT nextval('track_section_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: server
--
ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
--
-- Name: area_pkey; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--
ALTER TABLE ONLY area
ADD CONSTRAINT area_pkey PRIMARY KEY (id);
--
-- Name: entry_node_pkey; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--
ALTER TABLE ONLY entry_node
ADD CONSTRAINT entry_node_pkey PRIMARY KEY (sector_id, node_osm_id);
--
-- Name: env_node_pkey; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--
ALTER TABLE ONLY env_node
ADD CONSTRAINT env_node_pkey PRIMARY KEY (id);
--
-- Name: env_object_pkey; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--
ALTER TABLE ONLY env_object
ADD CONSTRAINT env_object_pkey PRIMARY KEY (id);
--
-- Name: map_mname_key; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--
ALTER TABLE ONLY map
ADD CONSTRAINT map_mname_key UNIQUE (mname);
--
-- Name: map_pkey; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--
ALTER TABLE ONLY map
ADD CONSTRAINT map_pkey PRIMARY KEY (id);
--
-- Name: overlap_area_pkey; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--
ALTER TABLE ONLY overlap_area
ADD CONSTRAINT overlap_area_pkey PRIMARY KEY (id);
--
-- Name: path_pkey; Type: CONSTRAINT; Schema: public; Owner: server; Tablespace:
--