python3 -m venv venv
uwsgi
Version 2.0.12uwsgi-plugin-python3
Then activate your virtual environment and then do.
npm install
pip install -r requirements.txt
python setup.py develop
FLASK_APP=endpoint.py flask db init
FLASK_APP=endpoint.py flask db migrate -m "Create all tables etc."
FLASK_APP=endpoint.py flask generate-fixtures
GITHUB_CLIENT_ID='<github-oauth-client-id>' GITHUB_CLIENT_SECRET='<github-oauth-client-secret>' GOOGLE_CLIENT_ID='<google-oauth-client-id>' GOOGLE_CLIENT_SECRET='<google-oauth-client-secret>' HOSTNAME=<hostname:port> SENDGRID_API_KEY=<sendgrid-api-key> ADMIN=<admin-email> FLASK_APP=endpoint.py flask run -h 0.0.0.0 -p 5000
Add an entry to your /etc/hosts
file pointing the hostname to the host ip address.
Then point your browser to http://<hostname>:5000
FLASK_APP=endpoint.py flask shell
- Make changes to the SQLAlchemy models in the project.
- Then create a migration with
FLASK_APP=endpoint.py flask db migrate -m "<description-of-migration>"
- Then apply the migration with
FLASK_APP=endpoint.py flask db upgrade
The tightest way to deploy this is as a WSGI application with NGINX proxying the web requests to the WSGI application. The obvious choice for running the WSGI application is uWSGI (which is included in the requirements.txt as a dependency). The setup is very simple.
- Create a user
endpoint
with home folder/home/endpoint
- Clone the repo into
/home/endpoint/endpoint
- Within
/home/endpoint/endpoint
runpython3 -m venv venv
. This will create a virtual environment under/home/endpoint/endpoint/venv
. - With the virtual environment activated, install all the requirements and run step.py to install endpoint.
- Initialize the database and setup the admin user and groups. Setup any additional users and groups you may need.
- Run
FLASK_APP=endpoint.py flask generate-deployment-configs -h test.com -r /home/code/endpoint
- Copy the file
deployment/endpoint.service
to/etc/systemd/system/endpoint.service
- Copy the file
deployment/endpoint-site
to/etc/nginx/sites-available/endpoint-site
- Chown the repo so that the user
www-data
can read and write to it:chown -R www-data:www-data /home/endpoint/endpoint
- Create a symlink to activate the configuration
ln -s /etc/nginx/sites-available/endpoint-site /etc/nginx/sites-enabled/endpoint-site
- Start the endpoint service
sudo service endpoint start
- Reload the Nginx config
sudo service nginx reload
- Point your browser to
http://<hostname>
and you should see the Endpoint site working.
npm install
npm install webpack
npx webpack
docker build -t <image-name> .
docker run -d -p 5000:5000 <image-name>
- At this point
docker ps
should show you the running container. - And then point your browser to
http://localhost:5000
and you should see the app.