PhotoPond is a java study project. It available by https://photopond.herokuapp.com
The purpose of the PhotoPond project was to develop a user-friendly web-application for storing images. After signing up the user can create directories and upload files. Each directory and file can be moved, renamed or deleted. A user can link his/her social (Facebook or Twitter) account to PhotoPond profile. If the social account is linked, user can authorize with it. When Twitter account has been linked a user can create a tweet and easily share images. Administrator can view basic information about all users, change user's login or role, delete users.
These instructions will give you a copy of the project and running on your local machine for development
For building and running the application you need:
- JDK 11
- MySQL 5.7 or PostgreSQL 10.6
- Git Guide
- Maven 3.5.3 or later (Installing Apache Maven)
Clone this repository onto your local machine. You can do it like this:
$ git clone https://github.com/JIeIIIa/PhotoPond
Open database terminal and type in the following command:
CREATE DATABASE PhotoPond;
- Create an application following App development
- Open created Facebook app
- Set up Facebook login (from Add a Product section)
- Open Settings->Basic and add App Domains (e.g.
localhost
) - Make a note of your App ID and App Secret
- Create an application following How to create a Twitter application
- On the Step 7 choose
Read and Write
Access permission - Open App details and add Callback urls (where <your_server_address> is the address to listen by Photopond application,
e.g.
http://127.0.0.1:8099
):<your_server_address>/public/twitter-auth/callback/login <your_server_address>/public/twitter-auth/callback/associate <your_server_address>/public/twitter-auth
You should choose exact one of prod
or dev
profiles and
one of disk-database-storage
or database-storage
. Also, you are able to use another profiles if necessary.
See below full list of available profiles:
- prod - if application run in production environment;
- dev - if application run in development environment (e.g. on your local pc);
- database-storage - if you want to store all information in database;
- disk-database-storage - if you want to store pictures on the disk. In this case in database store symbolic link on the picture;
- postgresql - if you want to use PostreSQL database, otherwise MySQL will be used;
- ssl - if you want to use https protocol. In this case you should replace localhostKeystore.p12 file to your own certificate
Use environment variables below:
- JDBC_DATABASE_URL - the JDBC URL to the database instance
(e.g.
jdbc:postgresql://localhost:5432/PhotoPond
) - JDBC_DATABASE_USERNAME - the database username
- JDBC_DATABASE_PASSWORD - the database password
- FACEBOOK_APPLICATION_ID - App ID of your Facebook App
- FACEBOOK_APPLICATION_SECRET - App Secret of your Facebook App
- TWITTER_CONSUMER_KEY - Consumer Key of your Twitter App
- TWITTER_CONSUMER_SECRET - Consumer Secret of your Twitter App
- KEY_STORE_PASSWORD - the password for the keystore (*.p12)
Also, you can change corresponding variables in *.properties files
This project can be built with Apache Maven.
Use the following steps to run the application locally:
- Execute next Maven goals to create the
target/photo-pond-1.0-SNAPSHOT.jar
file:$ mvn clean install -Dmaven.test.skip=true
- Run the application using
java -jar
, as shown in the following example:where:java -Dspring.profiles.active=<ACTIVE_PROFILES_LIST> <OTHER_VARIABLES> -jar target/photo-pond-1.0-SNAPSHOT.jar
- <ACTIVE_PROFILES_LIST> - list of spring boot active profiles
(e.g
dev,postgresql,database-storage
) - <OTHER_VARIABLES> - list of environment variables that are required to run
and have not been set before
(e.g.
-DJDBC_DATABASE_USERNAME=username
)
- <ACTIVE_PROFILES_LIST> - list of spring boot active profiles
(e.g
- Once running with
dev
active profile, the application will be available at:If you need to start your application on another port usehttp://localhost:8099/
-Dserver.port=PORT
variable.
- Spring boot - A framework that provides a simpler and faster way to set up, configure, and run both simple and web-based applications
- Thymeleaf - A server-side Java template engine
- Vue.js - An open-source JavaScript framework for building user interfaces and single-page applications
- Maven - Dependency Management
- Make sure that you are using java 8, and that maven version is appropriate.
should return something like:
mvn -v
Apache Maven 3.5.3 Maven home: C:\Program Files\Maven\bin\.. Java version: 1.8.0_192, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_192\jre
- Make sure that you have set all necessary variables.
- Oleksii Onishchenko - Initial work - JIeIIIa