Projet de gestion sécurisée des adhérents pour l'association Globe 42
The project uses PostgreSQL as a database.
You need to install PostgreSQL on your machine. When this is done, run the database creation script:
psql -h localhost -U postgres -f backend/database/database.sql
Clever Cloud produces backups twice a day. You can import a backend locally to test with the real production data
by executing the script
backend/scripts/importBackupLocally.sh. (Read the instructions inside the script).
The project uses Spring (5.x) for the backend, with Spring Boot.
You need to install:
- a recent enough JDK8
Then a the root of the application, run
./gradlew build to download the dependencies.
./gradlew bootRun to start the app.
The project uses Angular (4.x) for the frontend, with the Angular CLI.
You need to install:
- a recent enough NodeJS (6.9+)
- Yarn as a package manager (see here to install)
Then in the
frontend directory, run
yarn to download the dependencies.
yarn start to start the app, using the proxy conf to reroute calls to
/api to the backend.
The application will be available on http://localhost:4200
The application stores uploaded documents in Google Cloud Storage. This means that the application needs credentials (which are json files generated by Google) in order to work fine.
Two separate accounts, and thus credentials files, are used:
- one for development
- one for production
We expect to stay inside the "Always Free" tier, whatever the account is.
Here are various interesting links regarding Google Cloud Storage (GCS):
- The landing page of GCS
- The pricing page of GCS. It describes the conditions
of the "Always Free" tier. The most importtant part being that (as of now), the only regions
eligible to this free tier are
us-east1. This means that the buckets created for the application should be created in one of these 3 regions. We currently use only one bucket (for each account - dev and prod)
- The Google Cloud console: Make sure to select the appropriate
Google account when visiting it, and to select the
globe42project. It allows creating the bucket, browsing and deleting the files, creating credentials (service accounts), etc.
- The documentation, and the javadoc of the Java client library
To build the app, just run:
This will build a standalone jar at
backend/build/libs/globe42.jar, that you can run with:
java -jar backend/build/libs/globe42.jar --globe42.secretKey=<some secret key>
And the full app runs on http://localhost:9000
By default, the default GCS credentials are used when launching the app this way. That means
that the GCS APIs won't be accessible unless you set the
described in the documentation about default credentials
To avoid setting a global environment variable, you can instead use this command-line option:
This credentials file is located in the Ninja Squad Drive
Deployment on CleverCloud
Here is our application management on Clever Cloud. All the ninjas are admin for this app (they need to log in with github).
Log to Clever and add your Public SSH key. In the left navigation bar, go in "Profile" and in the "SSH Keys" tab. Add the key by entering a name and the public SSH key (the key is the entire contents of the id_rsa.pub file). To check if your ssh key is correctly configured, you can try to run:
Then clone locally the Git repository dedicated to the Clever deployment of Globe42 app :
git clone git+ssh://email@example.com/app_5e422400-281d-499b-b34c-7555c2f7fadd.git
Inside this repo you have :
- a json file containing the name of the jar to deploy : clevercloud/jar.json (don't modify this file)
- and a jar corresponding to the last deployment : globe42.jar
If you want to deploy a new version of the app:
- replace the globe42.jar by the new one, keeping the same name (you can find your last jar in
committhis new jar : (
git add .&
git commit -m "last version of Globe42 jar with a nice feature)
- push your work :
git push origin master
see the logs console and cross your fingers ;-)
Google Cloud Storage credentials on CleverCloud
Applications on CleverCloud don't have access to the file system. So, instead of defining an environment variable
containing the path of the GCS credentials, we use an environment variable,
containing the content of the production credentials file.