forked from categorizeus/categorizeus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local_setup.txt
87 lines (55 loc) · 3.24 KB
/
local_setup.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
1. Setup basic development
install java, git, eclipse
create github ssh credentials and add ssh key to github
2. Setup eclipse project
mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
3. Install Databases
sudo apt-get install postgresql postgresql-contrib pgadmin3 libpostgresql-jdbc-java libpostgresql-jdbc-java-doc
sudo -u postgres psql postgres
create a new user
create user categorizeus with password 'password';
create database categories;
GRANT ALL PRIVILEGES ON DATABASE categories to categorizeus;
4. Ignore the properties file, you don't want your password in git
git update-index --assume-unchanged src/main/resources/categorizeus.properties
5. Update core/src/main/resources/categorizeus.properties
make sure your password and directories correspond to your local machine
Right now SQL_BASE needs a specific directory and appends a path
SQL_BASE=/home/keefe/oss/categorizeus/
also, for the time being, specify the categorizeus.properties location in App.java (fixing soon)
mvn exec:java -Dexec.mainClass="us.categorize.App" -Dexec.args=""
6. Initialize the system from eclipse or command line
mvn exec:java -Dexec.mainClass="us.categorize.App" -Dexec.args="initialize"
this sets up the database
run this command to verify that the basics are up
curl http://localhost:8080/msg/1
{"title":"Thread:Here is the title1","body":"Here is the body1","postedBy":{"userName":"keefe","email":"keefe@categorize.us","userId":1},"id":1,"link":null,"thumbLink":null,"imgWidth":0,"imgHeight":0,"thumbWidth":0,"thumbHeight":0}
visit http://localhost:8080 and you should see a UI
Currently, development happens before adding https so make sure chromium doesn't auto redirect http to https, if this happens visit chrome://net-internals/#hsts and delete localhost
---some notes----
On a mac, there is a standalone app that is worth using.
Setup environment variables so that the server knows where assets are
for example, here is my ~/.bashrc (which also has a couple convenience alias)
To checkout some basic functionality, get a message:
http://localhost:8080/msg/1
to create a new message
curl -X POST -H 'Content-Type:application/json' -d@message.json http://localhost:8080/msg
Startup a new instance and install java 8 and nginx.
For https, let's encrypt offers a great free solution, so install certbot and configure it with nginx
https://certbot.eff.org/#ubuntutrusty-nginx
for me, this is
sudo ./certbot-auto certonly --webroot -w /usr/share/nginx/html/ -d categorize.us -d www.categorize.us
This will verify domain ownership automatically and generate the appropriate certificates.
Verify the SSL settings using a simple file server, for example add the following to the nginx config:
server {
listen 443 ssl;
server_name categorize.us www.categorize.us;
root /usr/share/nginx/html;
ssl_certificate /etc/letsencrypt/live/categorize.us/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/categorize.us/privkey.pem;
}
A full example nginx.conf configuring upstream for the java server is included in this directory.
Remember to create static/files, currently not automated
To ignore the properties file,
git update-index --assume-unchanged src/main/resources/categorizeus.properties
.gitignore wasn't working properly